[1000]A + B Problem

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[1000]A + B Problem相关的知识,希望对你有一定的参考价值。

1000: A+B Problem(1)

Time Limit: 10 Sec  Memory Limit: 125 MB
Submit: 745  Solved: 307

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.

 (0<=a,b<=10000)

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

[思路]硬要说的话,就是声明两个int类型的变量,然后记得赋值进去,然后把它们的和输出来,注意EOF的处理,如果利用scanf输入的话,可以写成~scanf(....)碰到EOF就会跳出来啦~!

[代码]

1 #include <iostream>
2 using namespace std;
3  
4 int main()
5 {
6     int a , b;
7     while(cin >> a >> b) cout << a + b << endl;
8     return 0;
9 }

 

以上是关于[1000]A + B Problem的主要内容,如果未能解决你的问题,请参考以下文章

2016百度之星资格赛

2016 湖南省省赛 Problem A: 2016

Problem-1000:A + B Problem

[1000]A + B Problem

codeforces round375(div.2)题解

Petrozavodsk Summer Training Camp 2017