1. 程式人生 > >九度+大數運算+Java直接呼叫BigInteger,注意必須定義的是Main類OJ才過

九度+大數運算+Java直接呼叫BigInteger,注意必須定義的是Main類OJ才過

點選開啟連結
import java.util.Scanner;
import java.math.*;
import java.text.*;
public class Main {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	 Scanner cin = new Scanner ( System.in );
	 BigInteger a,b;
	 while(cin.hasNext()){///相當於!=EOF
		 a=cin.nextBigInteger();
		 b=cin.nextBigInteger();
		 System.out.println(a.add(b));
		 System.out.println(a.subtract(b));
		 System.out.println(a.multiply(b));
		 }
	 }
}