杭州电子科技大学ACM-1093

来源:互联网 发布:pc装mac win10双系统 编辑:程序博客网 时间:2024/04/29 02:58

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 with one line of output for each line in input.
#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;}cout << sum << endl;}}    return 0;}

对于每一组输入整数,你应该在一条线和输出,并与输入各占一行输出。
0 0
原创粉丝点击