2012年9月2日
摘要: 简单的贪心题:只需要将结束时间利用进行排序后,在未安排的活动中挑选结束时间最早的活动安排,好给后面的活动安排留出更多的空间,从而达到安排最多活动的目标。 加上一个判断条件就可以搞定了代码:View Code 1 #include<iostream> 2 #include <stdlib.h> 3 using namespace std; 4 struct timee 5 { 6 int st; 7 int ed; 8 }t[102]; 9 int cmp (const void *a,const void *b)10 {11 return (*(timee *)a).. 阅读全文
posted @ 2012-09-02 14:02 xinmenghuairi 阅读(375) 评论(0) 推荐(0) 编辑