Poj1503

package easy;


import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Scanner;

/**
 *
 * Poj1503 
 * @author NC
 */
public class Poj1503 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        BigInteger sum = BigInteger.ZERO;
        while (scan.hasNext()) {
            BigInteger a = scan.nextBigInteger();
            sum = sum.add(a);
            if (a.compareTo(BigInteger.ONE) == -1) {
                break;
            }
        }
        System.out.println(sum);
    }
}


你可能感兴趣的:(java)