A+B for Input-Output Practice (VIII)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 73526    Accepted Submission(s): 22760

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 you must note that there is a blank line between outputs.

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

Sample Output
10

15

6

#include <stdio.h>
int main()
{int n,j=0;
 scanf("%d",&n);
    while(n--)
 {int a,i,m,sum=0;
  scanf("%d",&m);
  for(i=0;i<m;i++)
  {
  scanf("%d",&a);
  sum+=a;
  }
 printf(j++?"\n%d\n":"%d\n",sum);
 }
 return 0;
}

最新文章

  1. Java 快速排序两种实现
  2. Python之路----------迭代器
  3. css中的一些概念
  4. 4.2.1 网络请求之HTTP
  5. 【云计算】Kubernetes、Marathon等框架需要解决什么样的问题?
  6. Sublime发布Markdown博客
  7. jQuery 停止动画、jQuery Callback 函数、jQuery - Chaining
  8. Android进阶笔记12:Manymo(在线安卓系统模拟器工具)
  9. Application 可以存储全局变量
  10. Apache BeanUtils 1.9.2 官方入门文档
  11. 原生弹窗拖拽代码demo+简单的抽奖
  12. hdu_4507_吉哥系列故事——恨7不成妻(鬼畜数位DP)
  13. java 字符串替换函数replaceAll 一次同时替换多个字符串
  14. (视频)《快速创建网站》2.1 在Azure上创建网站及网站运行机制
  15. Holt-Winters
  16. Expo大作战(二十一)--expo如何分离(detach),分离后可以比react native更有优势,但也失去了expo的部分优势,
  17. hdu 2153 仙人球的残影
  18. celery在Django中的应用
  19. 利用cocoapods创建基于git的私有库Spec Repo
  20. Jade模板引擎学习(二)语法:代码、变量、循环、过滤器及mixin

热门文章

  1. APP-Android:APK
  2. bzoj2303
  3. 1046: [HAOI2007]上升序列(dp)
  4. Django day04 路由控制
  5. VScode常用插件(持续更新)
  6. Linux学习教程
  7. BZOJ 4057 状压DP
  8. 编写linux 命令行实用工具 shell命令
  9. Oracle调整内存参后报ORA-00844和ORA-00851
  10. 后端springmvc,前端html5的FormData实现文件断点上传