WORLDFINAL - Editorial

PROBLEM LINK:

Practice
Contest

Author: Riddhish Lichade
Tester: Riddhish Lichade
Editorialist: Ram Agrawal

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Conditional-Statement

PROBLEM:

Team A and Team B were ready to face each other in the world cup finals. However, due to heavy rains, the match did not take place. Both the teams were not ready to share the title. As it was the World finals, one team needed to be declared the winner. The organizing committee decided to declare the winner by a toss. Umpire tossed the coin with heads on the top. Team A calls for heads and the coin flips N times. Determine which team wins the cup.

QUICK EXPLANATION:

If N is even Tean A wins else Team B wins.

SOLUTIONS:

Setter's Solution
from sys import stdin
for _ in range(int(stdin.readline())):
    n=int(stdin.readline())
    if(n&1):
        print('B')
    else:
        print('A')
Editorialist's Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin>>t;
    while(t--){
        int n;cin>>n;
        (n%2==0) ? cout<<"A\n" : cout<<"B\n"; 
    }
    return 0;
}