HDOJ 1092 A+B for InputOutput Practice (IV)

http://acm.hdu.edu.cn/showproblem.php?pid=1092

acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了,

 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main (){
 5     int a,n;
 6     for(;;){
 7         int sum=0;
 8         cin>>n;
 9         if(n==0)
10         break;
11         for(int i=0;i<n;i++){
12             cin>>a;
13             sum+=a;
14         }
15         cout<<sum<<endl;
16     }
17     return 0;
18 }
原文地址:https://www.cnblogs.com/wsxjbky/p/3054082.html