A + B ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 883777 Accepted Submission(s): 266159 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
| |||
|
这是我用Java做的第一道题,居然wa了三发,原因是没多组输入???!!
下面给出代码:
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
while(in.hasNext()) {
int a=in.nextInt();
int b=in.nextInt();
System.out.println(a+b);
}
}
}
这里说明一下,用Java交题必须用Main作为主类。