第一篇博客,纪念一下入坑acm。
题目:hdu 1000
Problem Description
Calculate A + B.
Input
Each line will contain two integers A and B. Process to end of file.
Output
For each case, output A + B in one line.
Sample Input
1 1
Sample Output
2
Author
HDOJ
Recommend
We have carefully selected several similar problems for you: 1001 1089 1002 1090 1091
代码如下:
在这里第一次遇到了“EOF”,这个东西。在网上查的才知道要这样写。
简单说一下我的理解:这个东西可以输入多组数据而不结束,在这里是一个死循环,一直不能接束。
在网上查了一下,得到这么个说法:
EOF就是-1,是在stdio.h里定义的,scanf函数只有在第一个参数为NULL(空指针)的情况下,才可能返回EOF,否则,返回成功格式化并赋值的参数个数(>=0)。