HTAKES - Editorial

Problem Statement
Contest Source

Author, Tester and Editorialist : Rohail Alam

DIFFICULTY:

Simple

PREREQUISITES:

None

PROBLEM:

From the given conditions in the statement, you need to determine whether Sharma wins more matches than his opponent or not, the former case leading to Kalia winning his bet, or him losing his bet otherwise.

EXPLANATION:

To solve this problem, one has to make a key observation - The person who starts the game always wins

You can simply simulate a game on your own to realize that the above statement holds true. Notice that the first player will run out of corners first before the second player runs out of edges, as there are an equal number of corners and edges in a noughts and crosses grid.

Thus, Sharma will always be the winner of the finale if it has an odd number of games as he will end up having one point more than his opponent.

But if the finale has an even number of games, it ends in a stalemate as both of them will have the same number of points.

To put it simply, Kalia wins his bet if the value of N is Odd and loses his bet if the value of N is Even.

SOLUTIONS:

C++ Solution
#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        (n%2 == 0)? cout<<"BROKE\n" : cout<<"BIG\n";
    }
}
Python Solution
t = int(input())
while(t>0):
    t-=1
    n = int(input())
    ans = "BIG" if (n%2==1) else "BROKE"
    print(ans)