大數用法--JAVA
阿新 • • 發佈:2019-02-12
import java.util.*; import java.math.BigInteger; import java.io.*; public class Oj { public static void main(String[] args) { Scanner in = new Scanner(System.in); BigInteger a = in.nextBigInteger(); BigInteger b = in.nextBigInteger(); BigInteger c = a.add(b);// a+b BigInteger c = a.subtract(b);//a-b BigInteger c = a.multiply(b);//a*b BigInteger c = a.divide(b);//a/b BigInteger c = a.mod(b);//a%b BigInteger c = a.max(b); BigInteger c = a.min(b); System.out.println(c); } } /*基本方法*/ BigInteger a = BigInteger.valueof( 100 ); //賦值 int compareTo(BigInteger a);// 等於a返回0,小於a返回負數,大於a返回正數 static BigInteger.ONE; //靜態常量1 static BigInteger.ZERO;