GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday 16 November 2022

[Solution] Hackerman CodeChef Solution | Solution CodeChef



Problem

Hackerman wants to know who is the better player between Bob and Alice with the help of a game.

The game proceeds as follows:

  • First, Alice throws a die and gets the number A
  • Then, Bob throws a die and gets the number B
  • Alice wins the game if the sum on the dice is a prime number; and Bob wins otherwise.

Given A and B, determine who wins the game.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • The first and only line of each test case contains two space-separated integers A and B.

Output Format

For each test case, output on a new line the winner of the game: Alice or Bob.

Each letter of the output may be printed in either uppercase or lowercase, i.e, AliceALICEAlIce and aLIcE will all be considered equivalent.

Explanation:

Test case 1: A = 2 and B = 1. Their sum is 2+1 = 3 which is a prime number, so Alice wins.

Test case 2: A = 1 and B = 1. Their sum is 1+1 = 2 which is a prime number, so Alice wins.

Test case 3: A = 2 and B = 2. Their sum is 2 + 2 = 4 which is not a prime number, so Bob wins.

No comments:

Post a Comment