ACM——A + B Problem (4)
A + B Problem (4)
总提交:2496 测试通过:1249
描述
Calculate the sum of some integers.
输入
The input will consist of multiple test cases. Each test case consist of an integer N and then N integers following in the same line,separated by a space. A line starting with 0 terminates the input and this line is not to be processed.
输出
For test case, you should output their sum in one line, and with one line of output for each line in input. After each test case output, you should output one blank line.
样例输入
4 1 2 3 4
5 1 2 3 4 5
0
样例输出
10
15
题目来源
HDUOJ
#include<iostream>
#include<vector>
using namespace std;
int main(){
int i,a,b;
vector<int> ivec;
int sum=;
while(cin>>a)
{
if(a==)
break;
for(i=;i<a;i++)
{
cin>>b;
sum+=b;
}
ivec.push_back(sum);
sum=;
}
for(i=;i<ivec.size();i++)
cout<<ivec[i]<<endl<<endl;
return ;
}
ACM——A + B Problem (4)的更多相关文章
- ACM - a + b Problem
前几天看了ACM的第一题,映入眼帘的是一个“简单”的题目: 输入两个数,a,b 输出他们的和. 本着,此乃ACM的原则,便有了如下的思考: ACM的题目肯定很难,a+b,怎么可能直接printf,不行 ...
- ACM: A Simple Problem with Integers 解题报告-线段树
A Simple Problem with Integers Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %l ...
- ACM——A + B Problem (3)
Home Problems 1086 A + B Problem (3) 时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:2317 ...
- ACM——A + B Problem (2)
A + B Problem (2) 时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:2600 测试通过:137 ...
- ACM——A + B Problem (1)
A + B Problem (1) 时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:5907 测试通过:151 ...
- 2013年 ACM 有为杯 Problem I (DAG)
有为杯 Problem I DAG 有向无环图 A direct acylic graph(DAG),is a directed graph with no directed cycles . T ...
- ACM程序设计选修课——Problem E:(ds:图)公路村村通(优先队列或sort+克鲁斯卡尔+并查集优化)
畅通工程 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- ACM程序设计选修课——Problem D: (ds:树)合并果子(最优二叉树赫夫曼算法)
Problem D: (ds:树)合并果子 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 80 Solved: 4 [Submit][Status][ ...
- 【ACM】hdu_zs3_1008_Train Problem I_201308100835
Train Problem I Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Tota ...
随机推荐
- java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
最近在学习RxJava 感觉很happy ,happy的同时遇到不少问题 没办法一点一点来 上张帅图先 在使用RxJava + Retrofit 的时候 有时候接口请求参数不规范 比如 {} @For ...
- json-lib反序列化时(JSONObject.toBean),时间类型为空的处理
需求: 在我们的项目里希望JsonString传入日期类型值为空时,JSONObject.toBean时可以将Java对象的该日期属性设为null. 解决过程: json-lib反序列化Json字符串 ...
- diamond专题(四)—— 容灾机制
大家好,本次为大家带来diamond的容灾机制. diamond之所以表现的稳定可靠,除了架构简单之外,另一个重要原因是diamond具有一套完备的容灾机制,容灾机制涉及到client和server两 ...
- [liu yanling]测试流程
测试流程 1.制定测试计划 2.编辑测试用例 3.执行测试用例 4.发现并提交BUG 5.开发组修正BUG 6.对已修正BUG进行返测 7.修正完成的BUG将状态置为已关闭,未正确修正的BUG重新激活
- 经典sql总结(2)
如何做呢,跟上文区别不大. 我建个表,输入以下 select year, () as m1, () as m2, () as m3 from info2 as t group by year;
- bzoj2946 [Poi2000]公共串(SA,SAM)
[题意] 多串求LCS. [思路] 主要是想找一下SAM的优越感 :) velui good 后缀数组划分height需要注意不少细节 <_<,然后不停debug [代码] ...
- qualcomm platform camera porting
转载自http://www.cnblogs.com/thjfk/p/4086001.html camera基本代码架构 Camera原理:外部光线穿过lens后,经过color filter滤波后照射 ...
- centos svn快速搭建
搭建SVN服务,有效的管理代码,以下三步可以快速搞定. 1.安装 #yum install subversion 判断是否安装成功 [root@]# svnserve --version 有了SVN软 ...
- yum kvm
---恢复内容开始--- 1. 安装软件包: yum -y install virt-manager; yum install qemu-kvm yum install libvirt yum ...
- Sublime Text 2 使用心得
一. 前言 作为一个前端,有一款好的开发利器是必不可少的,editplus.notepad++都是不错的工具,体积轻巧,启动迅速(dw太浮肿了).最近,又有一款新的编辑器诞生,席卷前端界,惹得无数喜爱 ...