【ACM】hdu_1093_A+BV_201307261715
A+B for Input-Output Practice (V)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 36633 Accepted Submission(s): 24927
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
2
4 1 2 3 4
5 1 2 3 4 5
Sample Output
10
15
#include <stdio.h>
int main()
{int n;
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("%d\n",sum);
}
return 0;
}
最新文章
- 数据存储_ SQLite (1)
- 大公司的PHP面试题
- mysql:忘记root密码
- 用shell在一个文件后面的每一行追加数据
- ASP.NET MVC下使用文件上传
- Django的Many-to-Many(多对多)模型
- VS2013 打开项目时出现 未定义标识符string的解决办法
- StageFright框架流程解读
- HTML+CSS D08浮动
- [日志分析] Access Log 日志分析
- flex 圣杯布局
- vscode指定扩展安装位置
- iOS开发之获取当前展示的VC
- ABAP其实也是挺好的语言
- 文本文档中各字母出现次数汇总(java)
- NET的基本用法
- Linux安装rz/sz,htop插件
- zabbix3.4web界面添加第一台被监控服务器图文教程
- redis windows版本下载地址(不用hm提供的)
- python接口自动化-参数化