A + B Problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 532948 Accepted Submission(s): 168674
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
如果是刚刚入手HDOJ的朋友,这题主要是让你了解HDOJ的格式,以及大部分ACM竞赛的源代码格式。
与OI的格式不同,Input中有句话说:“一直持续到文件结束(Process to end of file.)”
这里给出AC代码:
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{int a,b,c;
while(scanf("%d%d",&a,&b)==2)
{c=a+b;
printf("%d\n",c);
}
return 0;
}