目录
原版题目
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.
输入格式:
The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.
输出格式:
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.
中文题目
你的任务是计算 a + b。
太容易了?!答案是肯定的!我专门为 acm 初学者设计了这个问题。
你一定发现有些问题与这个问题有相同的标题,是的,所有这些问题都是为同一个目标而设计的。
输入格式:
输入将由一系列整数 a 和 b 对组成,用空格分隔,每行一对整数。
输出格式:
对于每对输入整数 a 和 b,您应该在一行中输出 a 和 b 的总和,并且输入中的每一行都有一行输出。
输入样例:
1 5
10 20
输出样例:
在这里给出相应的输出。例如:
6
30
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
思路
本题可以看做是7-70的进阶版
代码
#include <stdio.h>
int main() {
int a, b;
while(scanf("%d %d", &a, &b) != EOF){ // 循环读入 a 和 b,直到结束
printf("%d\n", a + b); // 求和并输出
}
return 0;
}