oj中a+b大数加法

oj中a+b大数加法_第1张图片

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

 

你可能感兴趣的:(oj中a+b大数加法)