摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4452英语弱成渣,没看懂题目之前,样例没看明白。。trun around没注意。还有交换方向的时候理解错一句话,应该是题目写错了。模拟就是View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 int n,t1,s1,t2,s2,k; 7 char ch1,ch2; 8 char temp1,temp2; 9 int x1,y1,x2,y2; 10 int ...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4451View Code 1 #include <stdio.h> 2 #include<string.h> 3 #include <stdlib.h> 4 int main() 5 { 6 int n,m,k,n1,m1,k1; 7 int in[1010]; 8 int to[1010]; 9 int c,i,num1,num2;10 char str1[20],str2[20];11 while(~scanf("%d%d%d",&n,&am
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4450巨水题,不解释View Code 1 #include<stdio.h> 2 int main() 3 { 4 int n; 5 int c; 6 int i; 7 while(~scanf("%d",&n),n) 8 { 9 int sum=0;10 for(i=0;i<n;i++)11 {12 scanf("%d",&c);13 sum+=c*c;14 ...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4442比赛时做得很差,考虑时没考虑清楚,也正因为这样,才拖了很久,,最后一分钟提交,拿了个顽强拼搏奖,哈哈哈。。贪心:设已经排好一些,花时间t,然后考虑两情况哪种好(node[i].a,node[i].b),node[j].a,node[j].b),必有t+node[i].a+node[i].b*t+node[j].a+node[j].b(t+node[i].a+node[i].b*t)<=t+node[j].a+node[j].b*t+node[i].a+node[i].b(t+node[j].a+n
阅读全文
摘要:位运算比关系运算优先级低,果断被坑了…………a=1,b=1;if(a^b>=0) printf("YES\n");else printf("NO\n");//输出NO,我以为YES。。。巨囧。。。
阅读全文
摘要:View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define maxn 110 4 #define INF 0x7ffffff 5 #define Max(a,b) a>b?a:b 6 int graph[maxn][maxn]; 7 int vis[maxn]; 8 int dis[maxn]; 9 int n,m;10 void dijkstra()11 {12 int min,now;13 memset(vis,0,sizeof(vis));14 dis[1]=0;15 vis[1]=1;16 ..
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1205水题一枚,糊里糊涂就过了!!View Code 1 #include<stdio.h> 2 int main() 3 { 4 int t; 5 int n; 6 int x,max,sum; 7 scanf("%d",&t); 8 while(t--) 9 {10 max=0;11 sum=0;12 scanf("%d",&n);13 for(int i=0;i<n;i++)14 ...
阅读全文