标签:
PS: 开始ACM的受虐!
site:http://acm.acmcoder.com/listproblem.php
一、1000
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int a, b;
while (cin.hasNextInt()) {
a = cin.nextInt();
b = cin.nextInt();
System.out.println(a + b);
}
}
}
二、1001
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n;
long sum;
while (cin.hasNext()) {
n = cin.nextInt();
sum = n + 1;
sum = sum * n / 2;
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 sc = new Scanner(System.in);
int i = sc.nextInt();
for (int j = 1; j <= i; j++) {
BigInteger a = new BigInteger(sc.next());
BigInteger b = new BigInteger(sc.next());
System.out.println("Case " + j + ":");
System.out.println(a.toString() + " + " + b.toString() + " = "
+ a.add(b));
if (j != i)
System.out.println();
}
}
}
标签:
原文地址:http://www.cnblogs.com/xavierjzhang/p/4501433.html