Description
给出n个数,求和
Input
第一行为用例组数T,每组用例占一行包括序列长度n以及n个整数表示该序列
Output
对于每组用例,输出这n个数的和
Sample Input
2
4 1 2 3 4
5 1 2 3 4 5
Sample Output
10
15
Solution
纯净水
Code
#include<iostream>
using namespace std;
int main()
{
int n,t;
cin>>t;
while(t--)
{
cin>>n;
int sum=0,d;
for(int i=0;i<n;i++)
cin>>d,sum+=d;
cout<<sum<<endl;
}
return 0;
}