GUPTA MECHANICAL

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

Friday 8 July 2022

[Solution] Game of Piles Version 2 CodeChef Solution 2022


There are N piles where the ith pile consists of Ai stones.

Chef and Chefina are playing a game taking alternate turns with Chef starting first.
In his/her turn, a player can choose any non-empty pile and remove exactly 1 stone from it.

The game ends when exactly 2 piles become empty. The player who made the last move wins.
Determine the winner if both players play optimally.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇


  • Each test case consists of multiple lines of input.

Output Format

For each test case, output CHEF if Chef wins the game, otherwise output CHEFINA.

Note that the output is case-insensitive i.e. CHEFChefcHeF, and chef are all considered the same.

Bidding CodeChef Solution 

Pass the Exam CodeChef Solution

Chef and Candies CodeChef Solution

Journey of the Knight CodeChef Solution

Slow Solution CodeChef Solution 

Game of Piles Version 1 CodeChef Solution

Find A, B, C CodeChef Solution

Largest Square in the garden CodeChef Solution

Game of Piles Version 2 CodeChef Solution


Constraints

  • 1T1000
  • 2N105
  • 1Ai109
  • Sum of N over all test cases does not exceed 

No comments:

Post a Comment