S1001 无休止的 Calculate A+B
来源:互联网 发布:漫画控不能连接网络 编辑:程序博客网 时间:2024/06/05 19:43
Description
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.
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.
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.
It is guarantied that all integers and the sum are in the range of 32-int.
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
一,正确方法
#include <stdio.h> int main(void){int a, b;while (scanf("%d%d", &a, &b) != EOF){printf("%d\n", a + b);}return 0;}二,原理
while循环为什么永远都出不来?因为while里面有一个scanf(),每次运行到while都会等待你输入回车,然后scanf()读取你输入的数字,如果你输入的数字小于两个的时候输入回车,scanf()会继续等待你输入的数字大于等于两个然后执行while()循环。
阅读全文
0 0
- S1001 无休止的 Calculate A+B
- Calculate A + B.
- HDOJ-1089 Calculate a + b
- Your task is to Calculate a + b.
- 无休止的课程设计
- 简单题:Your task is to Calculate a + b.
- 无休止的手工测试,不累吗?
- 无休止的手工测试,不累吗?
- B - Calculate S(n)
- 病毒,无休止的泛滥……
- 如何应对永无休止的“新需求”
- calculate a point in triangle
- a&&b与a&b的区别
- A+B的问题
- XTU的A+B
- 人见人爱的a^b
- 大数的a+b
- A/B的困扰
- Bean Validation
- linux 关机命令总结
- GoldenDream-Dec.
- AutoCompleteTextView的使用
- mysql 模糊查询LIKE 在tp中使用
- S1001 无休止的 Calculate A+B
- C#——继承
- tomcat服务已经开启,自己可以访问但是同网段其他机器无法访问解决办法
- eclipse环境import工程出现中文乱码问题的解决方案
- springboot利用springsession实现redis共享session,并且自定义sessionid
- xml4种解析方法性能比较
- 测试计划2
- FastJson对JodaTime的处理
- 整合Spring时Service层为什么不做全局包扫描详解