Input
Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.
输入包含一个整数N在第一行,然后N行。每一行的开始都有一个整数M和M个整数,然后在同一行。
Output
For each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.
对于每一组输入整数,你应该在一条线和输出,你必须注意在输出之间的空白行。
#include<iostream>
using namespace std;
int main()
{
int n, m;
int k;
while (cin >> k)
{
while (k--)
{
cin >> n;
int sum = 0;
while (n--)
{
cin >> m;
sum += m;
}
if (k > 0)
{
cout << sum << endl << endl;
}
else
{
cout << sum << endl;
}
}
}
return 0;
}