A+B for Input-Output Practice (I)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 129829 Accepted Submission(s): 69922

Problem Description

Your task is to Calculate a + b.

Too easy?! Of course! I specially designed the problem for acm beginners.

You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim.

Input

The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.

Output

For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.

Sample Input

1 5

10 20

Sample Output

6

30

#include <iostream>
using namespace std;
int main (){
int a,b;
while (cin >> a>>b){
cout <<a+b<<endl;
}
return 0;
}

A+B for Input-Output Practice (II)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 97559 Accepted Submission(s): 62308

Problem Description

Your task is to Calculate a + b.

Input

Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.

Output

For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.

Sample Input

2

1 5

10 20

Sample Output

6

30

#include <iostream>
using namespace std;
int main (){
int n;
cin >>n;
while (n--){
int a,b;
cin >>a >>b;
cout <<a+b<<endl;
}
return 0;
}

A+B for Input-Output Practice (III)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 108194 Accepted Submission(s): 56933

Problem Description

Your task is to Calculate a + b.

Input

Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.

Output

For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.

Sample Input

1 5

10 20

0 0

Sample Output

6

30

#include <iostream>
using namespace std;
int main (){
int a,b;
while (cin>>a>>b,a||b){
cout<<a+b<<endl;
}
return 0;
}

A+B for Input-Output Practice (IV)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 99949 Accepted Submission(s): 52783

Problem Description

Your task is to Calculate the sum of some integers.

Input

Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.

Output

For each group of input integers you should output their sum 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

0

Sample Output

10

15

#include <iostream>
using namespace std;
int main (){
int n;
while (cin>>n,n){
int sum=0,num;
while (n--){
cin>>num;
sum+=num;
}
cout << sum <<endl;
}
return 0;
}

A+B for Input-Output Practice (V)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 74170 Accepted Submission(s): 49454

Problem Description

Your task is to calculate the sum of some integers.

Input

Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.

Output

For each group of input integers you should output their sum in one line, and with one line of output for each line in input.

Sample Input

2

4 1 2 3 4

5 1 2 3 4 5

Sample Output

10

15

#include <iostream>
using namespace std;
int main (){
int n;
while (cin>>n,n){
int sum=0,num;
while (n--){
cin>>num;
sum+=num;
}
cout << sum <<endl;
}
return 0;
}

A+B for Input-Output Practice (VI)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 69477 Accepted Submission(s): 46476

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,num;
while (cin >> n){
int sum = 0;
for (int i = 1;i <= n;i ++){
cin >> num;
sum += num;
}
cout << sum << endl;
}
return 0;
}

A+B for Input-Output Practice (VII)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 68666 Accepted Submission(s): 45664

Problem Description

Your task is to Calculate a + b.

Input

The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.

Output

For each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.

Sample Input

1 5

10 20

Sample Output

6

30

#include <iostream>
using namespace std;
int main (){
int a,b;
while (cin >> a >> b){
cout << a+b << endl << endl;
}
return 0;
}

A+B for Input-Output Practice (VIII)

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 149649 Accepted Submission(s): 45273

Problem Description

Your task is to calculate the sum of some integers.

Input

Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.

Output

For each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.

Sample Input

3

4 1 2 3 4

5 1 2 3 4 5

3 1 2 3

Sample Output

10

15

6

#include <iostream>
using namespace std;
int main (){
int n;
cin >> n;
while (n--){
int t,sum = 0,num;
cin >> t;
for (int i = 1;i <= t;i++){
cin >> num;
sum += num;
}
cout << sum << endl;
if (n) cout<< endl ;
}
return 0;
}

C++ 的简单输出输入 HDU 1089~1096的更多相关文章

  1. 【VB超简单入门】五、基本输出输入

    之前讲了VB IDE的基本操作和概念,接下来要开始将VB语言的编程了. 程序最重要的部分是输出和输入,输入数据,经过计算机处理,再输出结果.本文将介绍两种最基本的输出输入方法,分别是Print.Msg ...

  2. 1102: 零起点学算法09——继续练习简单的输入和计算(a-b)

    1102: 零起点学算法09--继续练习简单的输入和计算(a-b) Time Limit: 1 Sec  Memory Limit: 520 MB   64bit IO Format: %lldSub ...

  3. 1101: 零起点学算法08——简单的输入和计算(a+b)

    1101: 零起点学算法08--简单的输入和计算(a+b) Time Limit: 1 Sec  Memory Limit: 128 MB   64bit IO Format: %lldSubmitt ...

  4. java入门---简介&简单输出小例子&开发前准备

        Java是由Sun Microsystems公司于1995年5月推出的Java面向对象程序设计语言和Java平台的总称.由James Gosling和同事们共同研发,并在1995年正式推出.J ...

  5. Java基础(5)- 输出输入

    输出输入 public class Input { public static void main (String[] args){ try { /** * 打开文件流进行读取 */ Scanner ...

  6. c++学习笔记---05--- C++输出输入小结

    C++输出输入小结 题目: 这个程序将向用户提出一个"Y/N"问题,然后把用户输入的值赋值给answer变量. 要求: 针对用户输入'Y'或'y'和'N'或'n'进行过滤: 发掘程 ...

  7. C#实现并口输出输入高低电位

    PC并行口各阵脚定义: 1.选通,PC->Printer 2-9 数据(D0-D7) 10.应答(ACK),Printer->PC 11.忙(BUSY),Printer->PC 12 ...

  8. HDU 1089 到1096 a+b的输入输出练习

    http://acm.hdu.edu.cn/showproblem.php?pid=1089 Problem Description Your task is to Calculate a + b.T ...

  9. python简单的输入与输出

    1 首先利用python完成简单的输出,运行如下: python和c语言类似,但又有所不同,python开发快,语言简洁,我是这样对比学的 输出:print+空格+'要输出的内容',一定要是英文状态下 ...

随机推荐

  1. laravel中的注册页面

    <?php namespace App\Http\Controllers; use App\User; use Illuminate\Http\Request; class RegisterCo ...

  2. MAVEN 创建 JAR项目

    从Maven模板创建一个项目 在终端或命令提示(windows)中,浏览到要创建JAVA项目的文件夹下 键入如下命令: mvn archetype:generate -DgroupId={projec ...

  3. Win10系列:UWP界面布局进阶6

    在Windows 10的"个性化设置"中,用户可以更改计算机在锁屏状态下的背景图片,除此之外,也可以通过Windows应用商店应用程序将喜欢的图片设置为锁屏背景,下面通过一个示例来 ...

  4. 写一个xml文件到磁盘的方法

    /** * 往磁盘上写一个xml文件 * * <?xml version="1.0" encoding="UTF-8" standalone=" ...

  5. Valgrind,内存调试工具

    Valgrind是一款用于内存调试.内存泄漏检测以及性能分析的软件开发工具 官网:http://valgrind.org/ 用户开发手册地址:http://valgrind.org/docs/manu ...

  6. 【模板】AC自动机(简单版)

    我:“woc...AC自动机?” 我:“可以自动AC???” 然鹅... 大佬:“傻...” 我:“(⊙_⊙)?” 大佬:“缺...” 我:“......” (大佬...卒 | 逃...) emm.. ...

  7. 查看文件 ls -lh

    查看文件 ll ls -l --block-size=k ls -lh

  8. netty ------------ 如果selector检测到一个channel可以读了

    -----------------一个NioEventLoopGroup 的初始化的时候,会初始化一个 NioEventLoop数组,每个NioEventLoop在初始化的时候,会open一个sele ...

  9. Java Web相关概念调查

  10. Java语法基础学习DaySix

    一.JavaBean——可重用组件 1.JavaBean是指符合以下标准的Java类: (1)类是公共的 (2)有一个无参的公共的构造器 (3)有属性,且有对应的get.set方法 2.好处 用户可以 ...