随笔分类 -  algorithm

introduction to algorithm
摘要:Yanghee 的算术题目http://acm.hdu.edu.cn/showproblem.php?pid=2515Problem DescriptionYanghee 是一个小学生。他的数学老师给全班同学布置了一道家庭作业,即根据一张不超过5000的n(n<50)个正整数组成的数表,两两相加得到n(n-1)/2个和,然后把它们排序。例如,如果数表含有四个数1,3,4,9,那么正确答案是4,5,7,10,12,13。Yanghee 做完作业以后和小伙伴们出去玩了一下午,回家以后发现老师给的数表不见了,可是他算出的答案还在。你能帮助Yanghee根据他的答案计算出原来的数表吗?Input 阅读全文
posted @ 2012-10-24 21:44 菜鸟程序员的奋斗& 阅读(333) 评论(0) 推荐(0)
摘要:POJ 1328http://poj.org/problem?id=1328 1 #include <cstdio> 2 #include <cmath> 3 4 struct unit { 5 double h; 6 double t; 7 bool able; 8 }; 9 10 void work(int id,int m, int n);11 bool get_ht(int r,int x,int y,double *ph,double *pt);12 int main() {13 int m, n;14 int id=0;15 sca... 阅读全文
posted @ 2012-10-23 19:10 菜鸟程序员的奋斗& 阅读(574) 评论(0) 推荐(0)
摘要:转http://blog.csdn.net/ju136/article/details/6957771原题http://poj.org/problem?id=1042 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<set> 5 #include<iostream> 6 using namespace std; 7 8 class lake 9 {10 public:11 int id;12 int fishes;13 int dec;1 阅读全文
posted @ 2012-10-22 21:24 菜鸟程序员的奋斗& 阅读(450) 评论(0) 推荐(0)