CSES - Datatähti 2015 loppu - Results
Submission details
Task:Omenat
Sender:Perdex
Submission time:2015-01-29 12:22:51 +0200
Language:Java
Status:COMPILE ERROR

Compiler report

input/Q1.java:9: error: cannot find symbol
        IO io = new IO();
        ^
  symbol:   class IO
  location: class Q1
input/Q1.java:9: error: cannot find symbol
        IO io = new IO();
                    ^
  symbol:   class IO
  location: class Q1
2 errors

Code

package asdf;

import java.util.ArrayList;

public class Q1 {
    
    public static void main(String[] fuckingCopyRightBreaker){
        
        IO io = new IO();
        
        int n = io.nextInt();
        ArrayList<Integer> apples = new ArrayList<Integer>();
        int sum = 0, applesSum = 0;
        
        for(int i = 0; i < n; i++){
            int temp = io.nextInt();
            if(temp % 3 != 0){
                apples.add(temp);
                applesSum += temp;
                applesSum %= 3;
            }else{
                sum++;
            }
            
        }
        
        if(applesSum == 0){
            io.print((sum + apples.size()));
            io.close();
            return;
        }
            
        
        for(int i: apples){
            if(i % 3 == applesSum){
                io.print((sum + apples.size() - 1));
                io.close();
                return;
            }
                
        }
        
        for(int i: apples){
            for(int j: apples){
                if((i + j) % 3 == applesSum){
                    io.print((sum + apples.size() - 2));
                    io.close();
                    return;
                }
            }
        }
        
        
        io.println();
        
        io.close();
    }
    
    
    
    
}