Adding some more judges, here and there.
[and.git] / NEERC / xtra / xtra_re.java
blob557d746e615acc73a979b31be4a4d41f8e00798c
1 /*
2 Solution for NEERC'2008 Problem X: Xtrapolation
3 (C) Roman Elizarov
4 Note: this solution attempts to check correctness of the input
5 */
7 import java.io.*;
8 import java.util.*;
10 public class xtra_re {
11 private static final int MAX_NUM = 1000000000;
12 private static final int MAX_COUNT = 1000;
14 public static void main(String[] args) throws Exception {
15 new xtra_re().go();
18 void go() throws Exception {
19 BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
20 PrintStream out = System.out;
21 long sum = 0;
22 int count = 0;
23 while (true) {
24 int num = Integer.parseInt(in.readLine());
25 if (num == 0)
26 break;
27 assert num > 0 && num <= MAX_NUM;
28 count++;
29 assert count <= MAX_COUNT;
30 sum += num;
31 out.println(sum);
32 out.flush();