Buttons

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.9 kB
2
Indexable
Never
import java.util.*;
import java.lang.*;
import java.io.*;
 
/* Name of the class has to be "Main" only if the class is public. */
public class write {
    public static void main(String[] args) throws java.lang.Exception {
        int t1;
        Scanner sc = new Scanner(System.in);
        t1 = sc.nextInt();
        for (int i = 0; i < t1; i++) {
        int[] buttons = new int[3];
        for (int j = 0; j < buttons.length; j++) {
            buttons[j] = sc.nextInt(); // 1 1 1 
        } 
        int k = 0;   
        while(true){
            if((k % 2) == 0){ // 0 2
                if(buttons[2] != 0){ // 1 != 0, 0 != 0
                    buttons[2]--; //1-- -> 0
                    k++; // 0++ -> 1
                    continue;
                }
                else if(buttons[2] == 0 && buttons[0] > 0){ // 0 == 0
                    buttons[0]--; // 1-- -> 0
                    k++; //2++ -> 3
                    continue;
                }
                else if(buttons[2] == 0 && buttons[0] == 0){
                    break;
                }
            }
            else if((k % 2) != 0){ // 1 3
                if(buttons[2] != 0){ // 0 != 0, 0 != 0
                    buttons[2]--;
                    k++;
                    continue;
                }
                else if(buttons[2] == 0 && buttons[1] > 0){ //0 == 0, 0 == 0 && 
                    buttons[1]--; // 1-- -> 0
                    k++; // 1++ -> 2
                    continue;
                }
                else if(buttons[2] == 0 && buttons[1] == 0){
                    break;
                }
            }
        }
        if(k % 2 == 0){
            System.out.println("Second");
        }
        else if((k % 2) != 0){
            System.out.println("First");
        }
            
        }
    }
}