摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1160题意:要求找出老鼠体重递增,速度递减的最长子序列(不需要连续).输入到文件尾结束.输入完后再处理数据.有可能出现多种情况.满足一种即可.-------->用结构体记录体重和速度因有两个要求,所以要进行排序.我是按老鼠体重升序排序.排序时序号会乱.所以要记录编号.定义数组father[]记录子串个数.找的时候找到符合条件的.(体重递增,速度减少)记录他为前面记录最大的+1;(father[i] < father[j] + 1)并记录MAX的值.最后从MAX的位置向前查找.丢入栈中.最后出栈输出 阅读全文
posted @ 2012-09-07 21:34 zx雄 阅读(269) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1257用贪心的思想,每一个系统尽可能多的去拦截导弹.//View Code 1 #include <iostream> 2 #include <algorithm> 3 #include <stack> 4 using namespace std; 5 const int MAX = 1000 + 10; 6 const int INF = 0x3fffffff; 7 struct Mouse 8 { 9 int fat;10 int speed;11 int num;12 阅读全文
posted @ 2012-09-07 21:02 zx雄 阅读(226) 评论(0) 推荐(0) 编辑