[Solution] Game of Piles Version 1 CodeChef Solution 2022
There are piles where the pile consists of 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 stone from it.
The game ends when exactly 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 , denoting the number of test cases.
- Each test case consists of multiple lines of input.
- The first line of each test case contains a single integer denoting the number of piles.
- Next line contains space-separated integers - denoting the number of stones in each pile.
Output Format
For each test case, output CHEF
if Chef wins the game, otherwise output CHEFINA
.
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. CHEF
, Chef
, cHeF
, and chef
are all considered the same.
Constraints
- Sum of over all test cases does not exceed
No comments:
Post a Comment