加法:
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
BigInteger a = scan.nextBigInteger();
BigInteger b = scan.nextBigInteger();
BigInteger ans = BigInteger.ZERO; //初始化ans为0,ONE初始化为1
ans = a.add(b);
System.out.println(ans);
}
}
减法:
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
BigInteger a = scan.nextBigInteger();
BigInteger b = scan.nextBigInteger();
BigInteger ans = BigInteger.ZERO;
ans = a.subtract(b);
System.out.println(ans);
}
}
乘法:
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
BigInteger a = scan.nextBigInteger();
BigInteger b = scan.nextBigInteger();
BigInteger ans = BigInteger.ONE;
ans = a.multiply(b);
System.out.println(ans);
}
}
import java.math.BigInteger;
import java.util.*;
public class qiqi {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
BigInteger a = scan.nextBigInteger();
BigInteger b = scan.nextBigInteger();
BigInteger ans = BigInteger.ZERO;
ans = a.divide(b);
System.out.println(ans);
}
}