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