1005: A+B for Input-Output Practice (V)

Description

Your task is to calculate the sum of some integers.

 

Input

Input contains an integer N in the first line, and then N lines follow. Each line starts with an integer M, and then M integers follow in the same line. 

 

Output

For each group of input integers you should output their sum in one line, and with one line of output for each line in input. 

 

Sample Input

2
4 1 2 3 4
5 1 2 3 4 5

 

Sample Output

10
15

Code

#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int a;
        int ans=0;
        cin>>a;
        int s[a];
        while(a--)
        {
            cin>>s[a];
            ans+=s[a];
        }
        cout<<ans<<endl;
    }
    return 0;
}

 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 游动-白 设计师:白松林 返回首页