A+B for Input-Output Practice (V)
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
Sample Output
Author
lcy
程序代码:
- #include<stdio.h>
-
int main()
-
{
-
int i=0,t,n,j,count;
-
int sum=0;
-
int m[100];
-
-
scanf("%d",&n);
-
while(n--)
-
{
-
scanf("%d",&count);
-
while(count--)
-
{
-
scanf("%d",&t);
-
sum+=t;
-
}
-
m[i++]=sum;
-
sum=0;
-
}
-
for(j=0; j<i; j++)
-
{
-
printf("%d\n",m[j]);
-
}
-
-
return 0;
-
}
阅读(2123) | 评论(0) | 转发(0) |