Solution for CCC '16 J1 - Tournament Selection in Java 8


Nov. 6, 2019 0.949436 seconds Java 8
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
         Scanner in = new Scanner(System.in);
        int counter = 0;
        
        for(int i = 0; i < 6; i++){
          if(in.next().equals("W")){
                counter++;
            }  
        }

        if(counter == 0){
            System.out.println("-1");
        } else if(counter == 5 || counter == 6){
            System.out.println("1");
        }else if(counter == 3 || counter == 4){
            System.out.println("2");
        }else if(counter == 1 || counter == 2){
            System.out.println("3");
        }

    }
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.