SDUT1017

来源:互联网 发布:心事无人知 编辑:程序博客网 时间:2024/05/05 06:12

A+B for Input-Output Practice

Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^

题目描述

Your task is to calculate the sum of some integers

输入

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

输出

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.

示例输入

34 1 2 3 45 1 2 3 4 53 1 2 3

示例输出

10156

 

 

 #include<stdio.h>
  int main()
  {
      int i,n,s,a,m,k;
      while(scanf("%d",&m)!=EOF)
      {

          for(k=1;k<=m;k++)
          {
             s=0;
             scanf("%d",&n);
          for(i=1;i<=n;i++)
          {
              scanf("%d",&a);
              s=s+a;
              }
         printf("%d\n",s);
         printf("\n");
          }

     }
      return 0;
  }

 

0 0