码迷,mamicode.com
首页 > 其他好文 > 详细

[1000]A + B Problem (1)

时间:2016-04-03 22:09:17      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

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 (1)

标签:

原文地址:http://www.cnblogs.com/ticsmtc/p/5350533.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!