hdu 1094 A+B for Input-Output Practice (VI)
2016-05-22 22:41
711 查看
A+B for Input-Output Practice (VI)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 63087 Accepted Submission(s): 42387[align=left]Problem Description[/align]
Your task is to calculate the sum of some integers.
[align=left]Input[/align]
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.
[align=left]Output[/align]
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.
[align=left]Sample Input[/align]
4 1 2 3 4
5 1 2 3 4 5
[align=left]Sample Output[/align]
10
15
#include <iostream> using namespace std; int main() { int n; int test; //cin >> test; while(cin >> n) { int sum = 0; //cin >> n; int temp; for(int i = 1; i <= n; i++) { cin >> temp; sum += temp; } cout << sum << endl; } return 0; }
View Code
相关文章推荐
- thinkphp集成系列之短信验证码、订单通知
- hdu 1093 A+B for Input-Output Practice (V)
- hdu 1092 A+B for Input-Output Practice (IV)
- php类型转换
- 手机抓包总发现东北大学IP,你需要知道的NTP服务器
- Spark多文件输出(MultipleOutputFormat)
- 【php】json对象解码为array数组
- 9——PHP循环结构foreach用法
- laravel 5.1 源码阅读
- php 会话控制
- PHP之MVC学习
- 一个php文件实现打印金字塔
- PHP反射
- Aliyun 中PHP如何升级
- PHP高效率写法(详解原因)
- ThinkPHP的URL访问
- 使用paramiko的SFTP get或put整个目录
- FragmentPagerAdapter与FragmentStatePagerAdapter那些秘密的事
- PHP7中php.ini、php-fpm和www.conf的配置
- php 简单冒泡排序和选择排序