2012年5月11日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1846最简单的博弈论#include<iostream>#include<cmath>#include<string>#include<algorithm>#include<cstring>#include<cstdio>using namespace std;int main(){ int C; cin>>C; while(C--) { int n,m; cin>>n>>m; if(n%(m+1)== 阅读全文
posted @ 2012-05-11 08:58 夜-> 阅读(137) 评论(0) 推荐(0) 编辑
  2012年5月9日
摘要: http://poj.org/problem?id=1265pick定理对于方格点形成多边形面积=(内点)+(边上点/2)-1线段边上点数为(两点横坐标距离,两点纵坐标距离)的最大公约数 再加一对于本题来说 再加一的话 到最后还得剪掉 因为会重复计算 所以直接不加一就可以面积的求法 就是把多边形分割成多个三角形 需要自己动手画画#include<iostream>#include<cmath>#include<string>#include<algorithm>#include<cstring>#include<cstdio&g 阅读全文
posted @ 2012-05-09 21:42 夜-> 阅读(163) 评论(0) 推荐(0) 编辑
  2012年5月8日
摘要: http://poj.org/problem?id=3122#include<iostream>#include<string>#include<cstring>#include<cmath>#include<cstdio>#include<algorithm>using namespace std;const double K=1e-4;const double PI=acos(-1);const int N=10005;double size[N];int n,F;bool toosmall(double k){ in 阅读全文
posted @ 2012-05-08 20:34 夜-> 阅读(127) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1905#include<iostream>#include<string>#include<cstring>#include<cmath>#include<cstdio>#include<algorithm>using namespace std;const double K=1e-10;const double PI=acos(-1);int main(){ double L,n,C; while(cin>>L>>n>>C) { i 阅读全文
posted @ 2012-05-08 20:01 夜-> 阅读(150) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3258#include<iostream>#include<string>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;const int N=50005;int Dist[N];int L,n,m;bool toosmall(int k){ int sum=0; int pre=0; for(int i=1;i<=n;++i) { if(Dist[i]-pre<k) { 阅读全文
posted @ 2012-05-08 18:56 夜-> 阅读(181) 评论(0) 推荐(0) 编辑
  2012年5月6日
摘要: http://poj.org/problem?id=3273给你每天的花费,让你分成m组 要求各组的和中的最大值越小越好二分查找#include<iostream>using namespace std;const int N=100001;int n,m;bool toosmall(int k,int money[]){ int count=1;//k吧花费分成的组数,开始为一组 int sum=0; for(int i=1;i<=n;++i) { if(sum+money[i]>k)//如果超过k 应增加一组,所以count加一 sum更新重计 ... 阅读全文
posted @ 2012-05-06 10:55 夜-> 阅读(168) 评论(0) 推荐(0) 编辑
  2012年5月5日
摘要: http://poj.org/problem?id=3661二维DP#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>using namespace std;const int N=10005;const int M=505;int L[N];int rest[N][M];int norest[N][M];int main(){ int n,m; while(scanf("%d %d",&n,& 阅读全文
posted @ 2012-05-05 20:16 夜-> 阅读(129) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3660此题不是最短路 但可以用到 floydA牛可以打败B牛 B牛可以打败C牛 那么A牛一定可以打败C牛讲这个关系进行传递每一头牛打败别的牛(i头)和被别的牛打败(j头)的和(i+j)必须是n-1 才能确定其排名#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>using namespace std;const int N=105;bool beat[N][N];int 阅读全文
posted @ 2012-05-05 19:03 夜-> 阅读(156) 评论(0) 推荐(0) 编辑
  2012年5月4日
摘要: http://poj.org/problem?id=3292#include<iostream>#include<cstring>#include<string>#include<cstdio>using namespace std;const int N=1000001;int ans[N];void findans(){ memset(ans,0,sizeof(ans)); for(int i=5;i<N;i+=4) { for(int j=5;j<N;j+=4) { int temp=i*j; if... 阅读全文
posted @ 2012-05-04 20:34 夜-> 阅读(149) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2115自己最不喜欢的就是数论题 但不能因为不喜欢就不去做了 做会了就喜欢了通过做道题本人需要深刻的反省,做这道题浪费了我太多时间 代码中的long long 较多其中两个写成了long我愣是没看出来结果悲剧了N久 就此反省1.细心,不能代码一多就乱了2.明明可以用个#define long long LL 之类的代替的,既省时间有安全,为什么没用呀!亲。3.代码久调试不对,更放一下就的放一下。让脑子清醒一下。这道题就是。回去睡了一觉回来没用5分钟就发现错误了伤不起呀,以后要多加注意呀,得养成良好的编码习惯。对于扩展欧几里得算法理解的还不够清 阅读全文
posted @ 2012-05-04 19:22 夜-> 阅读(202) 评论(1) 推荐(0) 编辑