摘要: 题目:http://poj.org/problem?id=1042John去钓鱼,他有h个小时可以钓鱼(1 <= h <= 16),在一条路上,有n个湖(2 <= n <= 25),John从湖1开始钓鱼,他可以在任意一个湖结束。他只能依次经过湖,可以选择不停留。从第i个湖到第i+1个湖需要t[i]*5分钟。每个湖在最初的5分钟钓到的鱼的条数的期望是f[i],每钓5分钟鱼的期望减少d[i]。如果期望<=d[i],则在下一轮中池中没有鱼。为使期望最大,求John在每个湖的停留时间,和期望值。思路:枚举John在每一个湖停止钓鱼的最优解。先减去路上的耗时,然后优先钓鱼 阅读全文
posted @ 2013-02-04 14:28 Daniel Qiu 阅读(523) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/270/problem/C思路:每种盒子是独立的,四个小盒子换一个大盒子,最后剩下的一个盒子可以装下所有变长为2^k的盒子 找出对于所有k的边长最大的盒子。#include <iostream>#include <cmath>using namespace std;int arr[100005];int main(){ int n; cin>>n; int k,a; int ans=0; int maxk=0; for (int i = 0; i < n; i++) { c... 阅读全文
posted @ 2013-02-02 17:44 Daniel Qiu 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/270/problem/B思路:找出最后一个不满足升序的数字#include <iostream>using namespace std;int arr[100005];int main(){ int n; cin>>n; for (int i = 0; i < n; i++) { cin>>arr[i]; } int i; for ( i= n-2; i >= 0; i--) { if(arr[i]>arr[i+1]) break; } c... 阅读全文
posted @ 2013-02-02 17:40 Daniel Qiu 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/270/problem/A输入角度,判断能否构成正多边形思路:正n边形满足的角满足:angle=(n-2)*180/n#include <iostream>using namespace std;int main(){ int t; cin>>t; while (t--) { int n; cin>>n; if(360%(180-n)) cout<<"NO"<<endl; else cout <<"YES"<&l 阅读全文
posted @ 2013-02-02 17:38 Daniel Qiu 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1008 玛雅人历法的一道题。 不愧是POJ,看上去的一道水题都能这么恶心...这题WA了好多次 最早是漏了uayet 这个月份 然后是一年的最后一天当成了下一年 下面这组数据: 输入:4. uayet 259 输出:13 ahau 364 只要过了这组数据就没问题了...#include <iostream>#include <string>#include <stdio.h>#include <cstdlib>using namespace std;string hname[19]={ 阅读全文
posted @ 2013-01-31 23:51 Daniel Qiu 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1007 根据逆序数排序#include <iostream>#include <string>#include <stdio.h>#include <cstdlib>using namespace std;struct DNA{ string str; int rank;}dna[105];int cmp(const void *a,const void *b){ return ((struct DNA *)a)->rank-((struct DNA *)b)->rank;} 阅读全文
posted @ 2013-01-31 18:34 Daniel Qiu 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1006思路:中国剩余定理#include <iostream>#include <stdio.h>using namespace std;int main(){ int p,e,i,d; int c=1; while(1) { cin>>p>>e>>i>>d; if(p==-1) break; int n; n=(5544*p+14421*e+1288*i-d+21252)%(23*28*33); if(n==0) n=21252; ... 阅读全文
posted @ 2013-01-31 14:07 Daniel Qiu 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1005水题#include <iostream>#include <stdio.h>#include <algorithm>#include <string>#include <string.h>#include <cstdlib>#include <cmath>using namespace std;const double PI=3.1415926;int main(){ int n; cin>>n; for(int i=1;i< 阅读全文
posted @ 2013-01-31 00:12 Daniel Qiu 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1004水题#include <iostream>#include <stdio.h>#include <algorithm>#include <string>#include <string.h>#include <cstdlib>using namespace std;int main(){ float total=0; for(int i=0;i<12;i++) { float t; cin>>t; total+=t; } printf(&q 阅读全文
posted @ 2013-01-30 23:58 Daniel Qiu 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1003 模拟题,比1002简单好多...#include <iostream>#include <stdio.h>#include <algorithm>#include <string>#include <string.h>#include <cstdlib>using namespace std;int main(){ while(1) { float len; cin>>len; if(len==0) break; float temp=0; . 阅读全文
posted @ 2013-01-30 23:52 Daniel Qiu 阅读(118) 评论(0) 推荐(0) 编辑