UVa 424 - Integer Inquiry

传送门UVa 424 - Integer Inquiry

高精度水题..练手用╮(╯▽╰)╭


import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner (new BufferedInputStream(System.in));
		BigInteger num;
		BigInteger sum;
		sum = BigInteger.valueOf(0);
		BigInteger ok = new BigInteger("0");
		while (true)
		{
			num = cin.nextBigInteger();
			//System.out.println(num);
			if (num.compareTo(ok) == 0)
				break;
			sum = sum.add(num);
			//System.out.println(sum);
			
		}
		System.out.println(sum);
	}
}


你可能感兴趣的:(ACM,uva,424)