实现两个大数相加的java解法,调用库函数,
java.math.BigInteger a2 = new java.math.BigInteger(a);
java.math.BigInteger b2 = new java.math.BigInteger(b);
java.math.BigInteger result=a2.add(b2);
另外,求两个数的最大公约数的递归求法。
很简单。
int gcd(int x,int y){
return y==0?x:gcd(y,x%y);
}