CSU-1000 A+B (I) [ACM题解模板]

问题详细

题目链接: http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1000

1000:A+B(I)

Description

Your task is to Calculate a + b

Input

Input contains multiple test cases. Each test case consists of a pair of integers a and b ( 0 <= a, b <= 20 ), 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 1

Sample Output

2

Hint

Source

中南大学第五届大学生程序设计竞赛-热身赛

题目大意

对于给出的多组A和,求解A+B

解题思路

水题,直接相加即可。需要注意的是数据有多组,需要循环读入。

题解代码

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

using namespace std;

int main() {
int a, b;
while (EOF != scanf("%d %d", &a, &b)) {
printf("%d\n", a + b);
}
return 0;
}

写在最后

趁着考试周间隙,这次先写了一篇非常简单的题,算是简单的熟悉一下Markdown,再建一下一个模板。希望以后写题解就会比较方便了。