HDOJ1000
题目
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
代码
#include<stdio.h>
int main()
{
int a, b;
while(~scanf("%d%d",&a, &b)) //使用循环,因为有多组测试数据
{
printf("%d\n", a+b);
}
return 0;
}
Conclusion
第一次写HDOJ的时候,不知道有多组数据。当时一脸懵,这么简单的题目,怎么会写不对呢?后来才知道测试数据有很多,可以使用while循环重复输入测试数据。