武汉科技大学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为 ...
随机推荐
- 转:zookeeper3.4.5安装笔记
文章来自于:http://mmicky.blog.163.com/blog/static/150290154201392893623943/ 1:解压 官网zookeeper.apache.org ...
- Qt: 网络编程之UDP(理论+实例)
http://blog.csdn.net/rl529014/article/details/52888525
- 【模拟】HDU 5774 Where Amazing Happens
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5774 题目大意: 已知1946~2015每一年赢得人是谁,给n个名字,问赢了多少次. 题目思路: [ ...
- 4Sum——LeetCode
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = tar ...
- tinyxml开源库的基本用法
最近项目中的某个功能需要写xml,由于项目中已经引入了tinyxml,所以不再寻找其他开源库. 前提:你得有个xml对象,声明tinyxml的对象:基于tinyxml的内存管理,TiXmlDocume ...
- [Design Pattern] Service Locator Pattern 简单案例
Service Locator Pattern,即服务定位模式,用于定位不同的服务.考虑到 InitialContext::lookup 的成本比较高,提供了 Cache 类缓存以定位到的服务. 代码 ...
- UVA127- "Accordian" Patience(模拟链表)
"Accordian" Patience You are to simulate the playing of games of ``Accordian'' patience, t ...
- UIAlertController 的使用——NS_CLASS_AVAILABLE_IOS(8_0)
UIAlertView 随着苹果上次iOS 5的发布,对话框视图样式出现在了我们面前,直到现在它都没有发生过很大的变化.下面的代码片段展示了如何初始化和显示一个带有“取消”和“好的”按钮的对话框视图. ...
- Android---优化下载让网络访问更高效(三)
批处理传输和连接 每次启动一个连接---跟传输的数据大小无关---在使用典型的3G无线信号时,就会潜在的导致无线信号消耗近20秒的电量. 如果一个应用程序每隔20秒ping一次服务器,只是告知该应用程 ...
- Android学习_ContentProvider和Uri
ContentProvider概述 public abstract class ContentProvider extends Object implements ComponentCallbacks ...