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 1 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 1 pile becomes 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.
    • The first line of each test case contains a single integer N denoting the number of piles.
    • Next line contains N space-separated integers A1,A2,,AN - denoting the number of stones in each pile.

Output Format

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

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


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

Constraints

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

No comments:

Post a Comment