A+B for Input-Output Practice (VI)
2015-11-11 10:35
399 查看
A+B for Input-Output Practice (VI)
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
Your task is to calculate the sum of some integers.输入
Input contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.输出
For each test case you should output the sum of N integers in one line, and with one line of output for each line in input.示例输入
4 1 2 3 4 5 1 2 3 4 5
示例输出
10 15
提示
来源
HDOJ示例程序
#include<stdio.h> int main() { int i,n,a,sum; while(scanf("%d",&n)!=EOF) { i=1; sum=0; while(i<=n) { scanf("%d",&a); sum+=a; i++; } printf("%d\n",sum); } }
相关文章推荐
- A+B for Input-Output Practice (V)
- 专业级的PHP IDE——Zend Studio正式发布v13[附下载]
- PHP类 const常量访问方法例子
- 选择MySQL数据库的命令以及PHP脚本下的操作方法
- PHP 开发环境搭建
- MySQL创建和删除数据库的命令及相关PHP脚本的操作方法
- MySQL启动连接的命令以及与PHP程序连接的基本语法
- 为什么我用VS2010做EXTPB.NET程序,有些文件没有发布出去?
- 黄聪:PHP 免费获取手机号码归属地(转)
- php中超全局数组变量$_GET和$_POST以及单引号和双引号的区别
- php-fpm服务启动脚本 service chkconfig
- PHP用mb_string函数库处理与windows相关中文字符
- php,java获取天气预报代码
- 大学回顾和C与PHP之路
- PHP用mb_string函数库处理与windows相关中文字符及Win环境下开启PHP Mb_String方法
- PHP防止刷新重复提交页面的示例代码
- PHP中set error handler函数用法小结
- 2款PHP无限级分类实例代码
- php+mysql实现无限级分类
- 分享10段PHP常用代码