Game of Piles Version 1 Solution Codechef

Game of Piles Version 1 Solution Codechef 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 … Read more

Journey of the Knight Solution Codechef

Journey of the Knight Solution Codechef Chef has an 8×8 chessboard. He placed a knight on the square (X1,Y1). Note that, the square at the intersection of the ith row and jth column is denoted by (i,j). Chef wants to determine whether the knight can end up at the square (X2,Y2) in exactly 100 moves or not. For reference, a knight can move to a square which is: One … Read more

Slow Solution Solution Codechef

Slow Solution Solution Codechef Chef is trying to solve a problem having T test cases, where, for each test case he is given a single integer N. Chef has an algorithm which takes exactly N2 iterations for a test case with value N. The constraints of the problem are as follows: 1≤T≤maxT 1≤N≤maxN Sum of N over all test cases does not exceed sumN. Given … Read more

Chef and Candies Solution Codechef

Chef and Candies Solution Codechef

Chef and Candies Solution Codechef There are N children and Chef wants to give them 1 candy each. Chef already has X candies with him. To buy the rest, he visits a candy shop. In the shop, packets containing exactly 4 candies are available. Determine the minimum number of candy packets Chef must buy so that he is able to give 1 candy to each of the N children. Input … Read more

Pass the Exam Solution Codechef

Pass the Exam Solution Codechef

Pass the Exam Solution Codechef Chef appeared for an exam consisting of 3 sections. Each section is worth 100 marks. Chef scored A marks in Section 1, B marks in section 2, and C marks in section 3. Chef passes the exam if both of the following conditions satisfy: Total score of Chef is ≥100; Score of each section ≥10. Determine whether Chef passes the exam or not. Input Format … Read more