码迷,mamicode.com
首页 > 其他好文 > 详细

ACM_Power Mouth

时间:2018-06-24 15:12:21      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:inpu   简单   desc   CM   思路   acm   seve   include   turn   

Power Mouth

Time Limit: 2000/1000ms (Java/Others)

Problem Description:

Your task is to calculate the sum of some integers.

Input:

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.

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.

Sample Input:

It is easy.

Sample Output:

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 }

 

ACM_Power Mouth

标签:inpu   简单   desc   CM   思路   acm   seve   include   turn   

原文地址:https://www.cnblogs.com/acgoto/p/9220379.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!