您的位置:首页 > 编程语言 > PHP开发

「HD_ACM」A+B for Input-Output Practice (V)

2015-05-02 21:38 225 查看
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.

->输入包含一个整数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 <stdio.h>
#include <stdlib.h>
int main()
{
int n;
int i;
int k;
int b;
int t;
scanf("%d" , &n);
while( n--)
{
b=0;
scanf("%d" , &t);
for(i=0;i<t;i++)
{
scanf("%d" , &k);
b+=k;
}
printf("%d\n" ,b);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: