CSES - Datatähti 2017 alku - Results
Submission details
Task:Bittijono
Sender:roni.juntunen
Submission time:2016-10-07 21:20:24 +0300
Language:Java
Status:COMPILE ERROR

Compiler report

input/Bittijono.java:7: error: class Simppeli is public, should be declared in a file named Simppeli.java
public class Simppeli {
       ^
1 error

Code

import java.util.Scanner;

/**
 *
 * @author ronij
 */
public class Simppeli {
        public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = input.nextInt();
        int[] lookup = new int[count];
        byte[] table = new byte[count];
        for (int i = 0; i < count; i++) {
            lookup[i] = input.nextInt();
        }
        long[] time = new long[2];
        time[0] = System.currentTimeMillis();
        byte[] source = new byte[1048576];
        int power;
        for (int i = 0; i < 20; i++) {
            power = (int)Math.pow(2,i);
            for (int u = 0; u < power; u++) {
                if (source[u] == 0){
                    source[power + u] = 1;      
                }
                else{
                    source[power + u] = 0;
                }
            }
        }
        for (int i = 0; i < count; i++) {
            table[i] = source[lookup[i] - 1];
        }
        //time[1] = System.currentTimeMillis();
        //System.out.println(Arrays.toString(table));
        for (int i = 0; i < count; i++) {
            System.out.println(table[i]);
        }
        //System.out.println(time[1] - time[0]);
    }
}