【ACM】ACM steps 1.1.5*

A+B for Input-Output Practice (V)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 18072 Accepted Submission(s): 13110

Problem Description
Your task is to calculate the sum of some integers.

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.

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.

Sample Input
2
4 1 2 3 4
5 1 2 3 4 5

Sample Output
10
15

Author
lcy

参考题解:

#include
int main()
{
    int n,a,b,i,j,sum;
    sum=0;
    while(scanf("%dn",&n)!=EOF)
    {
        for(i=0;i

唔,九点了。感觉有点不在状态。本来打算今天刷完第一系列的,现在看看能刷到多少吧……
这道题也不是很难,尤其是有前一题做铺垫,注意有时候该写注释的写注释,定义的变量太多的话自己会晕掉的= =  。还有就是要注意最后还要对sum进行初始化。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注