武汉科技大学ACM :1006: A+B for Input-Output Practice (VI)
Problem Description
Your task is to calculate the sum of some integers.
Input
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.
Output
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.
Sample Input
4 1 2 3 4
5 1 2 3 4 5
Sample Output
10
15
#include <iostream>
using namespace std; int main()
{
int N,i;
while(cin >> N)
{
int sum = ;
while (N--)
{
cin >> i;
sum += i;
}
cout << sum << endl;
} return ;
}
武汉科技大学ACM :1006: A+B for Input-Output Practice (VI)的更多相关文章
- 武汉科技大学ACM :1001: A+B for Input-Output Practice (I)
Problem Description Your task is to Calculate a + b. Too easy?! Of course! I specially designed the ...
- 武汉科技大学ACM :1008: A+B for Input-Output Practice (VIII)
Problem Description Your task is to calculate the sum of some integers. Input Input contains an inte ...
- 武汉科技大学ACM :1007: A+B for Input-Output Practice (VII)
Problem Description Your task is to Calculate a + b. Input The input will consist of a series of pai ...
- 武汉科技大学ACM :1005: A+B for Input-Output Practice (V)
Problem Description Your task is to calculate the sum of some integers. Input Input contains an inte ...
- 武汉科技大学ACM :1004: A+B for Input-Output Practice (IV)
Problem Description Your task is to Calculate the sum of some integers. Input Input contains multipl ...
- 武汉科技大学ACM :1003: A+B for Input-Output Practice (III)
Problem Description Your task is to Calculate a + b. Input Input contains multiple test cases. Each ...
- 武汉科技大学ACM :1002: A+B for Input-Output Practice (II)
Problem Description Your task is to Calculate a + b. Input Input contains an integer N in the first ...
- 武汉科技大学ACM:1006: 我是老大
Problem Description 今年是2021年,正值武汉科技大学 ACM俱乐部成立10周年.十周年庆祝那天,从ACM俱乐部走出去的各路牛人欢聚一堂,其乐融融.庆祝晚会上,大家纷纷向俱乐部伸出 ...
- 武汉科技大学ACM:1005: Soapbear and Honey
Problem Description Soapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey ve ...
- 武汉科技大学ACM:1006: 华科版C语言程序设计教程(第二版)例题4.17
Problem Description 输入一个整数,求它的素数因子.并按照格式输出. Input 一个整数n.(2<=n<=100) Output n=a*b*c*... (a,b,c为 ...
随机推荐
- Linux——搭建PHP开发环境第二步:PHP
原文链接:http://www.2cto.com/os/201511/450258.html ##### PHP 编译安装 #### [root@localhost ~]# yum install l ...
- 如何通过HOOK改变windows的API函数(找到函数的相对偏移)
我们知道,系统函数都是以DLL封装起来的,应用程序应用到系统函数时,应首先把该DLL加载到当前的进程空间中,调用的系统函数的入口地址,可以通过GetProcAddress函数进行获取.当系统函数进行调 ...
- C#中两个时间的比较
var DateTimedt1 = Convert.ToDateTime(dt); var DateTimedt2 = Convert.ToDateTime(DateTime.Now); ...
- [转]Java Daemon Startup Script
How to start a Java program as a Linux daemon with an /etc/init.d script. See also: http://www.sourc ...
- 聚焦设计交易与商业落地 DANG·DHUB设计师平台上线【图】_品牌资讯_服饰_太平洋时尚网
聚焦设计交易与商业落地 DANG·DHUB设计师平台上线[图]_品牌资讯_服饰_太平洋时尚网 聚焦设计交易与商业落地 DANG·DHUB设计师平台上线
- 在sql语句中使用plsql变量
示例代码如下: create or replace type ua_id_table is table of number; declare v_tab ua_id_table;begin v_tab ...
- H5页开发规范/通用规范
兼容目标 主流移动设备:iPhone 4+ .三星.魅族.华为.红米.小米1S 以上及主流 Android 千元机型:请特别关注iPhone4/4s.魅族MX4.华为P6等机型 操作系统:iOS 7. ...
- POJ3080:Blue Jeans
Description The Genographic Project is a research partnership between IBM and The National Geographi ...
- javascript 数组 排除null, undefined, 和不存在的元素
The most common way to loop through the elements of an array is with a for loop: var o = [1,2,3,4,5] ...
- Git学习资料整理
Git作为一个优秀的版本控制系统,是我们开发人员必须要学会使用的一个工具,接触git一年多以来,也看了不少相关资料,今天把我所看过的一些学习资源整理一下. Git入门当然首推廖雪峰廖老师的教程:Git ...