为了快速解决高精度问题,总算是要来接触java了,算上这学期要开java的课了,好好学习吧!
拿来练手的是hdu的1002,高精度加法。
import java.util.*;
import java.math.*;
import java.io.*; public class Main {
public static void main(String []args) { Scanner in = new Scanner(System.in);
int n = in.nextInt();
for(int cnt=1; cnt<=n; cnt++)
{
BigInteger a = in.nextBigInteger();
BigInteger b = in.nextBigInteger();
BigInteger c = a.add(b);
System.out.println("Case "+cnt+":");
System.out.println(a + " + " + b + " = " + c);
if(cnt < n)
System.out.println();
}
}
}