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

  1. 4 1 2 3 4
  2. 5 1 2 3 4 5

Sample Output

  1. 10
  2. 15
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int N,i;
  7. while(cin >> N)
  8. {
  9. int sum = ;
  10. while (N--)
  11. {
  12. cin >> i;
  13. sum += i;
  14. }
  15. cout << sum << endl;
  16. }
  17.  
  18. return ;
  19. }

武汉科技大学ACM :1006: A+B for Input-Output Practice (VI)的更多相关文章

  1. 武汉科技大学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 ...

  2. 武汉科技大学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 ...

  3. 武汉科技大学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 ...

  4. 武汉科技大学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 ...

  5. 武汉科技大学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 ...

  6. 武汉科技大学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 ...

  7. 武汉科技大学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 ...

  8. 武汉科技大学ACM:1006: 我是老大

    Problem Description 今年是2021年,正值武汉科技大学 ACM俱乐部成立10周年.十周年庆祝那天,从ACM俱乐部走出去的各路牛人欢聚一堂,其乐融融.庆祝晚会上,大家纷纷向俱乐部伸出 ...

  9. 武汉科技大学ACM:1005: Soapbear and Honey

    Problem Description Soapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey ve ...

  10. 武汉科技大学ACM:1006: 华科版C语言程序设计教程(第二版)例题4.17

    Problem Description 输入一个整数,求它的素数因子.并按照格式输出. Input 一个整数n.(2<=n<=100) Output n=a*b*c*... (a,b,c为 ...

随机推荐

  1. android 休眠唤醒机制分析(一) — wake_lock

    本文转自:http://blog.csdn.net/g_salamander/article/details/7978772 Android的休眠唤醒主要基于wake_lock机制,只要系统中存在任一 ...

  2. 转:Thumbs.db是什么文件?是病毒吗?怎么处理?

    今天有朋友兴冲冲的问我,Thumbs.db是什么文件?是病毒吗?会不会对电脑产生危害. 很多朋友对Thumbs.db这个文件不了解,会以为是病毒,实际上并非如此.那么,Thumbs.db是什么文件?有 ...

  3. RSS新闻阅读器

    1.RSS格式结构 http://rss.sina.com.cn/blog/tech/kj.xml <?xml version="1.0" encoding="ut ...

  4. [Android] 获取音频输出getOutput

    每创建一个AudioTrack,代表需要新增一个输出实例,即需要根据音频流的的stream type,音频流的音轨数量,采样率,位宽等数据来重新构建buffer,而且输出的设备也可能会有变化,由于An ...

  5. 使用Java Applet在客户端解压缩,以及使用证书的意义

    以前解压缩是用Java Applet在客户端解压缩,而且用户不知道这回事.但是现在Chrome不支持NP API了,所以不得不把Java去掉,然后在服务器里解压缩.风险在于,解压缩以后,传输到客户端的 ...

  6. 令人头痛的ExtJS日期时间控件

    1 缘由 Ext提供了日期.时间的控件,但没有将日期和时间组合在一起的控件.在网上搜索时,有前辈创建或重写了时间相关的类,并提供了源码.不得不说那位作者对 extjs 框架理解得很透彻,虽然不知道他当 ...

  7. 【HDOJ】3587 NUDOTA

    字符串模拟水题. /* 3587 */ #include <iostream> #include <cstdio> #include <cstring> #incl ...

  8. POJ1260 Pearls(dp,矩阵链乘法)

    题目链接. 题目大意: 给定一个n,和两个序列a[i], p[i]. a[i] 表示需要购买 i品质 的数量,p[i] i 等级的价格. 1.每个品质都会有不同的价格,价格依据品质上升而上升 2.买一 ...

  9. cf701C They Are Everywhere

    Sergei B., the young coach of Pokemons, has found the big house which consists of n flats ordered in ...

  10. Spring JDBC 随笔

    Spring 框架,借助 JdbcTemplate 类来简化 java 访问 database. 完成一个增查改删(CRUD)的基本功能,借助下面 5 个角色来共同来完成. 1. object cla ...