随笔分类 -  HDUACM

一些acm题目解答
摘要:#include<iostream> using namespace std; __int64 gcd(__int64 a,__int64 b) { return b?gcd(b,a%b):a; } __int64 lcm(__int64 a,__int64 b) { return a/gcd(a, 阅读全文
posted @ 2017-01-25 00:14 王坤1993 阅读(144) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main() { int k, a, i, flag; while(~scanf("%d", &k)) { for(i=0; i<66; i++) { if((18+k*i)%65==0) break; } if(i<66) printf("%d\n", 阅读全文
posted @ 2017-01-25 00:13 王坤1993 阅读(147) 评论(0) 推荐(0)
摘要:#include <stdio.h> int calc(int a, int b) { if(a==0 || a==1 || a==5 || a==6) return a; if(a==2) { if(b%4==1) return 2; if(b%4==2) return 4; if(b%4==3) 阅读全文
posted @ 2017-01-25 00:13 王坤1993 阅读(181) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; int main() { int n,m,a,sum=0; while(cin>>n) { while (n--) { cin>>m; sum=0; while (m--) { cin>>a; sum=sum+a; } 阅读全文
posted @ 2017-01-25 00:12 王坤1993 阅读(233) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; int main() { int b,a; while(cin>>a>>b) { cout<<a+b<<endl<<endl; } return 0; } 阅读全文
posted @ 2017-01-25 00:11 王坤1993 阅读(182) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;int main(){ int n; while(cin>>n){ int sum=0; int i,m; for(i=1;i<=n;++i){ cin>>m; sum+=m; } cout<<sum<<endl; } re 阅读全文
posted @ 2017-01-25 00:09 王坤1993 阅读(231) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; int main() { int n,m,a,sum=0; while(cin>>n) { while (n--) { cin>>m; sum=0; while(m--) { cin>>a; sum=sum+a; } 阅读全文
posted @ 2017-01-25 00:08 王坤1993 阅读(187) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; int main() { int n,a,sum=0; while(cin>>n&&n!=0) { while (n--) { cin>>a; sum=sum+a; } cout<<sum<<endl; sum=0; 阅读全文
posted @ 2017-01-25 00:07 王坤1993 阅读(209) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){ int a,b; while(scanf("%d%d",&a,&b)==2) { if(a==0&&b==0) break; else printf("%d\n",a+b); } return 0; } 阅读全文
posted @ 2017-01-25 00:05 王坤1993 阅读(152) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;int main(){ int n; cin>>n; while(n--){ int a,b; cin>>a>>b; cout<<a+b<<endl; } return 0;} 阅读全文
posted @ 2017-01-23 20:04 王坤1993 阅读(182) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std; int main() { int n,m,s; while(cin>>n>>m) { s=n+m; cout<<s<<endl; } return 0; } 阅读全文
posted @ 2017-01-22 23:34 王坤1993 阅读(191) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> int main() { char s[10000]; int len; int cnt = 0; while(~scanf("%s",s)) { if(!strcmp(s,"<br>")) { cnt = 0; prin 阅读全文
posted @ 2017-01-22 23:32 王坤1993 阅读(185) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> int main() { int d[1001], ans[1001]; int n, i, j, flag, rst; while(~scanf("%d", &n) && n) { for(i=0; i<n; i++) 阅读全文
posted @ 2017-01-22 23:31 王坤1993 阅读(125) 评论(0) 推荐(0)
摘要:#include <iostream>#include <stdio.h>#include <string.h>#include <stack>#include <queue>#include <map>#include <set>#include <vector>#include <math.h> 阅读全文
posted @ 2017-01-22 23:27 王坤1993 阅读(179) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cstring> using namespace std; int n[3],a[9000],b[9000],i,j,k,last,last2; int v[3]={1,2,5}; int main() { while ((cin>>n[0 阅读全文
posted @ 2017-01-22 23:26 王坤1993 阅读(146) 评论(0) 推荐(0)
摘要:#include<iostream> #include<algorithm> using namespace std; #define N 101 struct node { int score; //学生分数 int num; //学生做出的题目数目 char time[10]; //花费时间 } 阅读全文
posted @ 2017-01-22 23:24 王坤1993 阅读(253) 评论(0) 推荐(0)
摘要:#include"stdio.h" #include"string.h" #define N 305 int mark[N],link[N],map[N][N],p; int find(int a) //匈牙利算法,二分匹配 { int i; for(i=1;i<=p;i++) { if(!mark 阅读全文
posted @ 2017-01-22 23:22 王坤1993 阅读(144) 评论(0) 推荐(0)
摘要:#include<iostream> #include<stack> #include<string> #include<cctype> using namespace std; #define N 30 struct node { char m; int r,c; } a[N]; string s 阅读全文
posted @ 2017-01-22 23:21 王坤1993 阅读(182) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std; int GetMaxNum(int a[],int n) //求最大字段和 { int i,sum=0,maxsum=0; maxsum|=1<<31; for(i=1;i<=n;i++) { sum+=a[i]; if 阅读全文
posted @ 2017-01-22 23:19 王坤1993 阅读(187) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std; char s1[105],s2[105]; int val[5][5]={ {5,-1,-2,-1,-3}, {-1,5,-3,-2,-4}, {-2,-3,5,-2,-2}, {-1,-2,-2,5,-1}, {-3, 阅读全文
posted @ 2017-01-22 23:17 王坤1993 阅读(195) 评论(0) 推荐(0)