Odds and Evens: ODDSEVENS

link: https://www.codechef.com/CU1PP0009/problems/ODDSEVENS

Alice and Bob play the classic game of odds and evens. In this game, each of the two players choose a number between 11 and 55 without revealing to their opponent. Both of the players then simultaneously reveal their number by holding up that many fingers of their hand. Then the winner is decided based upon whether the sum of numbers played by both the players is odd or even. In this game we assume that if the sum is odd then Alice wins, otherwise Bob wins.

If Alice held up aa fingers and Bob held up bb fingers, determine who won the game.

Input Format

  • First line will contain TT, number of testcases. Then the TT testcases follow.
  • Each testcase contains of a single line of input, two integers a,ba,b which denote the number played by Alice and Bob respectively.

Output Format

For each testcase, output which player won the game.

Constraints

  • 1≤T≤10001≤T≤1000
  • 1≤a,b≤51≤a,b≤5

Sample Input 1 

2
1 1
1 2

Sample Output 1 

Bob
Alice

Explanation

In the first test case, Alice and Bob both played 11. The sum of the numbers played by them is 22 which is even. Therefore Bob wins.

In the second test case, Alice played 11 while Bob played 22. The sum of the numbers played by them is 33 which is odd. Therefore Alice wins.

Solution:

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

#define INF INT_MAX
#define MOD 1000000007
#define all(x) x.begin(), x.end()

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int T; cin >> T;
    while(T--){
        int a, b; cin >> a >> b;
        if((a+b) % 2 == 0) cout << "Bob\n";
        else cout << "Alice\n";
    }

    return 0;
}


See also  Chef and Pairing Slippers: CHEFSLP