7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)

目录

原版题目

输入格式:

输出格式:

中文题目

输入格式:

输出格式:

输入样例:

输出样例:


原版题目

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;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

吾乃宇宙欠债王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值