A + B Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 734213 Accepted Submission(s): 226452
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
题目大意:
每行输入两个整数,处理到文件结尾;输出A+B的和并换行。
Talk is cheap. Show me the code.
#include <stdio.h>
int main()
{
int A, B;
while ( scanf( "%d %d", &A, &B ) != EOF ) //注意处理到文件结尾,即直到scanf返回值等于EOF(End Of File)时结束;
printf( "%d\n", A + B );
return 0;
}
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1000