A+B for Input-Output Practice (IV)
2015-09-15 20:43
731 查看
Total Submission(s): 78164 Accepted Submission(s): 41910
[align=left]Problem Description[/align]
Your task is to Calculate the sum of some integers.
[align=left]Input[/align]
Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.
[align=left]Output[/align]
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.
[align=left]Sample Input[/align]
4 1 2 3 4
5 1 2 3 4 5
0
[align=left]Sample Output[/align]
10
15
[align=left]Author[/align]
lcy
[align=left]Recommend[/align]
JGShining | We have carefully selected several similar problems for you: 1093 1094 1095 1096 2001
A+B for Input-Output Practice (IV)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 78164 Accepted Submission(s): 41910
[align=left]Problem Description[/align]
Your task is to Calculate the sum of some integers.
[align=left]Input[/align]
Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.
[align=left]Output[/align]
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.
[align=left]Sample Input[/align]
4 1 2 3 4
5 1 2 3 4 5
0
[align=left]Sample Output[/align]
10
15
[align=left]Author[/align]
lcy
[align=left]Recommend[/align]
JGShining | We have carefully selected several similar problems for you: 1093 1094 1095 1096 2001
#include<stdio.h> int main(){ int n; while(scanf("%d",&n)&&n){ int m,sum=0; while(n--){ scanf("%d",&m); sum=sum+m; } printf("%d\n",sum); sum=0; } return 0; }
相关文章推荐
- A+B for Input-Output Practice (I)
- php 在线人数,今日访问量,总访问量统计
- PHP中静态(static)调用非静态方法详解
- php环境配置
- thinkphp实现数组分页示例
- thinkphp3.2版本 分页类 page.class.php url错误
- PHP扩展编写入门
- php函数mt_rand和rand 速度测试
- Yii文件(图片)上传时相关的方法
- Yii上传文件(头像)的一个例子(后端处理)
- PHP Socket 编程过程详解
- Yii 上传文件(头像)详解(三)
- vsftp命令使用:文件上传及下载
- Yii上传文件头像详解(二)
- php 类似ceil 小数位进一
- PHP 保持中文编码 json_encode 函数
- PHP 下载保存文件到本地
- ThinkPHP开发必备composer扩展包
- Yii上传文件(头像)详解(一)
- 搭建一个FTP服务器