Input
Input contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.
输入包含多个测试案例,一案一行。每一种情况下,一开始就有一个整数n的n个整数,然后在同一行。
Output
For each test case you should output the sum of N integers in one line, and with one line of output for each line in input.
对于每一个测试案例你应该输出N行整数之和,与一行输入每一行输出。
#include<iostream>
using namespace std;
int main()
{
int n, k;
while (cin >> n)
{
int sum = 0;
while (n--)
{
cin >> k;
sum += k;
}
cout << sum << endl;
}
return 0;
}