HDOJ 1094 A+B for Input-Output Practice (VI)

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

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

 

 1 #include<iostream>
 2 #include<stdio.h>
 3 using namespace std;
 4 int main (){
 5     int a,n;
 6     while(scanf("%d",&n)!=EOF){
 7         int sum=0;
 8         for(int i=0;i<n;i++){
 9             cin>>a;
10             sum+=a;
11         }
12         cout<<sum<<endl;
13     }
14     return 0;
15 }

 

posted on 2013-05-02 09:50  wsxjbcy  阅读(113)  评论(0编辑  收藏  举报

导航