java大数是个好东西,用起来方便,代码短. 代码如下: import java.util.*; import java.math.*; public class Main { public static void main(String args[]) { Scanner cin = new Scanner(System.in); BigInteger a , b; while(cin.hasNext()) { a = cin.nextBigInteger(); b = cin.nextBig…