17 my program produces the correct result and the compiler on the site does not skip

Back to Problem Solutions forum

Popovich Arseny Igorevich     2020-06-07 19:53:54

package com.company; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;

public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

    long result = 0;
    long Sonic = 0;
    final int seed = 113;
    final int limit = 10000007;
    boolean point = false;

    while (point == false) {
        String numa = reader.readLine();
        long a = Integer.parseInt(numa);
        if (a == -1) { point = true;}
        result = (result + a) * seed;
        if (result < limit) {
            System.out.print(result);
        }
        if (result > limit) {
            Sonic = result % limit;
            System.out.print(Sonic);
        }
    }
}

}

sontran     2020-06-07 21:00:33

If you have correct results from running your code, simply paste the results and the source code then click Submit. There's no need to run it on the site.

Please login and solve 5 problems to be able to post at forum