NYOJ103 A+B Problem II

原题链接

练一下java里的大数类

import java.util.Scanner;
import java.math.BigInteger;
public class Main{
	public static void main(String[] args){
		int n, i = 1;
		BigInteger a, b;
		Scanner cin = new Scanner(System.in);
		n = cin.nextInt();
		while(n-- > 0){
			a = cin.nextBigInteger();
			b = cin.nextBigInteger();
			System.out.println("Case " + i++ + ":");
			System.out.println(a + " + " + b + " = " + a.add(b));
		}
	}
}

796149 长木 A+B Problem II Accepted 35 368 java 04-04 12:13:13

你可能感兴趣的:(NYOJ103 A+B Problem II)