題目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=365
import java.util.*; import java.lang.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { Scanner k = new Scanner(System.in); int index=0; BigInteger data = new BigInteger("0"); while(k.hasNext()){ String input = k.next(); if(input.equals("0")){ System.out.println(data.toString()); break; } data=data.add(new BigInteger(input)); } } }
沒有留言:
張貼留言