http://acm.hdu.edu.cn/game/entry/problem/list.php?chapterid=1§ionid=2
2.
#include <stdlib.h> int main() { int a,b,d=0; int n; scanf("%d",&n); int i = 0; for (;i<n;++i) { scanf("%d%d",&a,&b); d=a+b; printf("%d\n",d); } return 0; }</p>
3.
#include <stdio.h> #include <stdlib.h> int main() { int a,b,d=0; while(scanf("%d%d",&a,&b),a,b) { d=a+b; printf("%d\n",d); } return 0; }
4.
int main() { int a=0,d=0,n=0; scanf("%d",&n); while(n) { for (int i=0;i<n;++i) { scanf("%d",&a); d+=a; } printf("%d\n",d); d=0; scanf("%d",&n); } return 0; }
5.
int main() { int a,b,d=0; int n,m; while(scanf("%d",&n)!=EOF) { for (int i = 0;i<n;++i) { scanf("%d",&m); if (m) { for (int i=0;i<m;++i) { scanf("%d",&a); d+=a; } printf("%d\n",d); d = 0; } } } return 0; }
6.
int main() { int a,b,d=0,sum=0; int n,m,i; while(scanf("%d",&n) != EOF) { while(n--) { scanf("%d",&m); sum=0; for(i=1;i<=m;i++) { scanf("%d",&a); sum=sum+a; } printf("%d\n",sum); } } return 0; }
7.
int main() { int a,b,c; while(scanf("%d %d",&a,&b) != EOF) { c = a+b; printf("%d\n\n",c); } return 0; }
8.
int main() { int a,sum,n,m; scanf("%d",&n); for(int i=0; i<n; i++) { scanf("%d",&m); sum = 0; for(int j=0; j<m; j++) { scanf("%d",&a); sum += a; } printf("%d\n",sum); if(i<n-1) printf("\n"); } return 0; }