题目从HDU1089~HDU1096,都属于非常简单的格式输出控制类题目,练多了很容易AC。
一,HDU1089:http://acm.hdu.edu.cn/showproblem.php?pid=1089
#include<stdio.h> int main() { int a,b; while(scanf("%d %d",&a,&b)!=EOF) printf("%d/n",a+b); return 0; }
二,HDU1090:http://acm.hdu.edu.cn/showproblem.php?pid=1090
#include<stdio.h> int main() { int n,a,b; while(scanf("%d",&n)!=EOF) { while(n--) { scanf("%d %d",&a,&b); printf("%d/n",a+b); } } return 0; }
三,HDU1091:http://acm.hdu.edu.cn/showproblem.php?pid=1091
#include<stdio.h> int main() { int a,b; while(scanf("%d %d",&a,&b)&&(a!=0||b!=0)) printf("%d/n",a+b); return 0; }
四,HDU1092:http://acm.hdu.edu.cn/showproblem.php?pid=1092
#include<stdio.h> int main() { int n,x,sum; while(scanf("%d",&n)&&n!=0) { sum = 0; while(n--) { scanf("%d",&x); sum+=x; } printf("%d/n",sum); } return 0; }
五,HDU1093:http://acm.hdu.edu.cn/showproblem.php?pid=1093
#include<stdio.h> int main() { int n,m,x,sum; while(scanf("%d",&n)!=EOF) { while(n--) { scanf("%d",&m); sum=0; while(m--) { scanf("%d",&x); sum+=x; } printf("%d/n",sum); } } return 0; }
六,HDU1094:http://acm.hdu.edu.cn/showproblem.php?pid=1094
#include<stdio.h> int main() { int n,x,sum; while(scanf("%d",&n)!=EOF) { sum = 0; while(n--) { scanf("%d",&x); sum+=x; } printf("%d/n",sum); } return 0; }
七,HDU1095:http://acm.hdu.edu.cn/showproblem.php?pid=1095
#include<stdio.h> int main() { int a,b; while(scanf("%d %d",&a,&b)!=EOF) { printf("%d/n/n",a+b); } return 0; }
八,HDU1096:http://acm.hdu.edu.cn/showproblem.php?pid=1096
#include<stdio.h> int main() { int n,m,x,sum; while(scanf("%d",&n)!=EOF) { while(n--) { scanf("%d",&m); sum=0; while(m--) { scanf("%d",&x); sum+=x; } printf("%d/n",sum); if(n!=0)printf("/n"); } } return 0; }
做题目到挺快的,就是写博客贴代码麻烦呀!! 终于完了~~