A + B Problem (4)

时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte
总提交: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)的更多相关文章

  1. ACM - a + b Problem

    前几天看了ACM的第一题,映入眼帘的是一个“简单”的题目: 输入两个数,a,b 输出他们的和. 本着,此乃ACM的原则,便有了如下的思考: ACM的题目肯定很难,a+b,怎么可能直接printf,不行 ...

  2. ACM: A Simple Problem with Integers 解题报告-线段树

    A Simple Problem with Integers Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %l ...

  3. ACM——A + B Problem (3)

    Home Problems 1086 A + B Problem (3) 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte总提交:2317 ...

  4. ACM——A + B Problem (2)

    A + B Problem (2) 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte总提交:2600            测试通过:137 ...

  5. ACM——A + B Problem (1)

    A + B Problem (1) 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte总提交:5907            测试通过:151 ...

  6. 2013年 ACM 有为杯 Problem I (DAG)

    有为杯  Problem I DAG  有向无环图 A direct acylic graph(DAG),is a directed graph with no directed cycles . T ...

  7. ACM程序设计选修课——Problem E:(ds:图)公路村村通(优先队列或sort+克鲁斯卡尔+并查集优化)

    畅通工程 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  8. ACM程序设计选修课——Problem D: (ds:树)合并果子(最优二叉树赫夫曼算法)

    Problem D: (ds:树)合并果子 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 80  Solved: 4 [Submit][Status][ ...

  9. 【ACM】hdu_zs3_1008_Train Problem I_201308100835

    Train Problem I Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)Tota ...

随机推荐

  1. android webview 访问https页面 SslError 处理

    在Android中,WebView可以用来加载http和https网页到本地应用的控件.但是在默认情况下,通过loadUrl(String url)方法,可以顺利loadUrl(“http://www ...

  2. [liu yanling]软件测试用例的基本要素包括哪些?

    用例编号: 测试用例的编号有一定的规则,比如系统测试用例的编号这样定义规则: PROJECT1-ST-001 ,命名规则是项目名称+测试阶段类型(系统测试阶段)+编号.定义测试用例编号,便于查找测试用 ...

  3. LittleTool之批量修改材质

    using UnityEngine; using System.Collections; using UnityEditor; public class ChangeMaterial : Editor ...

  4. 费用提前计算相关的DP(BZOJ2037,POJ3042,ZOJ3469)

    在刷ZeroClock大神的区间DP专辑,遇见了ZOJ3469,完全不无从下手,然后有人说是论问题,推荐看徐源盛<对一类动态规划问题的研究>这篇论文,果断得膜拜了下,感觉好神奇,可以把未来 ...

  5. string,vector和array(C++ Primer读书笔记)

    string string是标准库类型,使用时需要包涵头文件,使用using声明. include <string> using std::string; 1.定义和初始化 string ...

  6. 8-13-Exercise

    链接:夜间活动 昨天的比赛好郁闷.......倒不是因为题目......在快要比赛的时候突然所有的网站都进不去了.......改了半天的DNS & IP......比赛都比了1个多小时才进去. ...

  7. 杀死当前Excel进程

    说明: 代码编写过程中,有时需要杀死当前Excel进程,而不影响其他Excel进程. 代码如下: 添加引用: //杀死当前进程的API引用 using System.Runtime.InteropSe ...

  8. Mybatis上路_06-使用Java自动生成

    目录[-] 1.编写Generator执行配置文件: 2.在MyEclipse中建空web项目: 3.编写并执行Java程序: 4.查看并修改生成的文件: 5.测试,使用生成的文件查询: 1)导入My ...

  9. HDU 3333 & 3874 (线段树+离线询问)

    两个题目都是求区间之内,不重复的数字之和,3333需要离散化处理................. 调试了一下午........说多了都是泪........... #include <iostr ...

  10. 关于IOS中UIWebView 加载HTML内容

    NSString *strContent=[info objectForKey:@"newContent"]; { NSArray *paths = NSSearchPathFor ...