poj1503

高精度

View Code
import java.util.*;

import java.math.*;



public class Main {

    public static void main(String[] args)

    {

        Scanner cin = new Scanner(System.in);

        BigInteger a = cin.nextBigInteger();

        BigInteger sum = BigInteger.ZERO;

        while (!a.equals(BigInteger.ZERO))

        {

            sum = sum.add(a);

            a = cin.nextBigInteger();

        }

        System.out.println(sum);

    }

}

 

你可能感兴趣的:(poj)