HDU 1096 A+B for Input-Output Practice (VIII)(水~)

来源:互联网 发布:拉拉热门交友软件 编辑:程序博客网 时间:2024/04/28 23:39

Description
给n个数,求和
Input
第一行为用例组数T,每组用例占一行包括序列长度n以及n个整数表示该序列
Output
对于每组用例,输出a+b,每两组输出间用一空行隔开
Sample Input
3
4 1 2 3 4
5 1 2 3 4 5
3 1 2 3
Sample Output
10

15

6
Solution
纯净水
Code

#include<iostream>using namespace std;int main(){    int t;    cin>>t;    while(t--)    {        int n;        cin>>n;        int sum=0,d;        for(int i=0;i<n;i++)            cin>>d,sum+=d;        cout<<sum<<endl;        if(t)            cout<<endl;    }    return 0;}
0 0