摘要: 此题是一个与我的上篇文章 “东东的女朋友” 极为类似的算法的一道题,依然是贪心算法的应用,针对于此题,需要注意的是不可以同时移动的情况(Impossible)的第3种,和可以移动(Possible)的情况的第二种(见下图):下面代码及解释如下:View Code #include <stdio.h>#include <stdlib.h>#include <string.h>struct node{ int s; int t;}count[1000];int flag[1000];int cmp(const void *a ,const void *b){ s 阅读全文
posted @ 2011-12-08 10:31 world_ding 阅读(201) 评论(0) 推荐(0) 编辑