2011年5月1日

Bus System 我对自己无语了。。wa了n次原来输出格式搞错了。唉。

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>#define inf 0x7f7f7f7f7f7f7f7fLL__int64 map[110][110],cost[10],dis[10],sta[110];int a,b,M,N,l=0;__int64 exp(__int64 x){ if(x==0) return 0; if(x>0&&... 阅读全文

posted @ 2011-05-01 20:18 more think, more gains 阅读(191) 评论(0) 推荐(0) 编辑

Minimum Transport Cost

摘要: 这道题我从下午两点开始做,一开始时dijkstra算法做的,做到后面才悲剧地发现,我根本无法正确记录路径,悲剧啊。。。想了一阵子还是没有想出方法,想到想到竟然睡着了。。 最后想起了, floyd 算法。。不得不删了重新再写一次。。。。用floyd算法写的时侯,参考了下小白的,最后测试数据全通过了。。没想到提交wa..最后检查了好久还发现输出total cost时侯,我用的是map[a][b],,而... 阅读全文

posted @ 2011-05-01 17:46 more think, more gains 阅读(316) 评论(0) 推荐(0) 编辑

18岁生日

摘要: #include<stdio.h>void fun(int x,int y,int z){ int i,j,sum=0,flag=1; int A[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; for(i=y+1;i<=12;i++) sum+=A[i]; sum+=A[y]-z; if(x%4==0&&(x%100!=0||x%400==0)&&y<=... 阅读全文

posted @ 2011-05-01 12:14 more think, more gains 阅读(256) 评论(0) 推荐(0) 编辑

{A} + {B}

摘要: #include<stdio.h>#include<algorithm>using namespace std;int A[10010],B[10010],visit[10010],C[10010];//一开始数组开小了,提示runtime error accese ..int main( ){ int N,M,i,j,k; while(scanf("%d%d",&N,&M)!=EOF) { k=... 阅读全文

posted @ 2011-05-01 10:51 more think, more gains 阅读(183) 评论(0) 推荐(0) 编辑

小明A+B

摘要: #include <stdio.h>int main( ){ int n; int a, b; scanf("%d", &n); while (n--) { scanf("%d%d", &a, &b); printf("%d\n", (a % 100 + b % 100) % 100); } return 0;} 阅读全文

posted @ 2011-05-01 09:39 more think, more gains 阅读(233) 评论(0) 推荐(0) 编辑

整数解

摘要: #include<stdio.h>#include<math.h>int main( ){ int a,b,t; while(scanf("%d%d",&a,&b),a|b){ t=sqrt(a*a-4*b); printf(a*a-4*b>=0&&(a*a-4*b-t*t==0)?"YES\n":"NO\n"); }return 0;}数学题。。 阅读全文

posted @ 2011-05-01 09:25 more think, more gains 阅读(209) 评论(0) 推荐(0) 编辑

导航