Click Here to go back to the homepage.

Volim Solution:


import java.util.*;

public class Kattis {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int curr = Integer.parseInt(sc.nextLine());
        int questions = Integer.parseInt(sc.nextLine());
        int time = 0;
        for(int i = 0; i < questions; i++){
            String[] line = sc.nextLine().split(" ");
            time += Integer.parseInt(line[0]);
            if(time > 210)
                break;
            if(!line[1].equals("T"))
                continue;
            curr++;
        }
        curr = (curr % 8 == 0)?8 :curr % 8;
        System.out.println(curr);
    }
}