标签:inpu 简单 desc CM 思路 acm seve include turn
Your task is to calculate the sum of some integers.
The input contains several cases,each case contains an integer N in the first line, and then N lines follow(as a group). Each line starts with a integer M, and then M integers follow in the same line.
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.
It is easy.
It is simple.
解题思路:题目很简单,输出之间要有一空行。
AC代码:
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 LL sum,n,m,x;bool flag; 5 int main(){ 6 while(cin>>n){ 7 flag=false; 8 while(n--){ 9 cin>>m;sum=0; 10 if(flag)cout<<endl;//输出之间留一空行,第一次不输出,以后每次都输出空行 11 while(m--){cin>>x;sum+=x;} 12 cout<<sum<<endl; 13 flag=true; 14 } 15 } 16 return 0; 17 }
标签:inpu 简单 desc CM 思路 acm seve include turn
原文地址:https://www.cnblogs.com/acgoto/p/9220379.html