现在的位置: 首页 > 综合 > 正文

大数用法–JAVA

2017年10月03日 ⁄ 综合 ⁄ 共 563字 ⁄ 字号 评论关闭
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;   

抱歉!评论已关闭.