java写acm类名必须为Main
第1000题
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
while (s.hasNextInt()) {
int a = s.nextInt();
int b = s.nextInt();
System.out.println(a + b);
}
}
}
第1001题
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
while (s.hasNextInt()) {
int n = s.nextInt();
int sum = 0;
for (int i = 0; i <= n; i++) {
sum = sum + i;
}
System.out.println(sum);
System.out.println();
}
}
}
第1002题
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for (int i = 0; i < t; i++) {
BigInteger a = s.nextBigInteger();
BigInteger b = s.nextBigInteger();
System.out.println("Case" + " " + +(i + 1) + ":");
System.out.println(a + " + " + b + " = " + a.add(b));
if (i != t - 1) {
System.out.println();
}
}
}
}