Healer solution codechef

Healer solution codechef

Lately, a lot of pokemon were brought into the Pokemon Center. So Nurse Joy decided to train her pokemon- Chansey and Bellossom for emergencies.

They were given the initial HP(i)(i) of the patient and the final HP(f)(f) that the patient should have after their recovery. Chansey and Bellossom alternate turns and perform one healing operation in each turn. Chansey heals first. A pokemon wins this training if i=fi=f after performing certain healing operations.

A healing operation can be defined as:

  1. Select an integer xx (1<xi2)(1<x≤i2) and an integer yy (1y<x)(1≤y<x)
  2. Update ii as: i=i+(xy)i=i+(x−y)

Both Chansey and Bellossom heal optimally. Help Nurse Joy declare the winner of the training.

Input: Healer solution codechef

  • First-line will contain TT, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, two integers i,fi,f.

Output: Healer solution codechef

For each test case, output in a single line the winner of the training, Chansey or Bellossom.

Constraints Healer solution codechef

  • 1T1051≤T≤105
  • 4if10184≤i≤f≤1018

Sample Input: Healer solution codechef

6 10

Sample Output: Healer solution codechef



Chansey starts healing. She selects x=3x=3 and y=2y=2. Therefore i=6+(32)=7i=6+(3−2)=7.

Now it’s Bellossom’s turn. She selects x=3x=3 and y=1y=1. Therefore i=7+(31)=9i=7+(3−1)=9. No matter what Bellossom chooses in this turn, Chansey is sure to win in the next turn.

Chansey selects x=2x=2 and y=1y=1 such that i=9+(21)=10=fi=9+(2−1)=10=f. Therefore Chansey is the winner. Had Chansey not selected xx and yy optimally, Bellossom could have won.


Click here

Healer solution codechef The Maths Lock solution codechef Minimum Adjacent Swaps to Reach the Kth Smallest Number Minimum Interval to Include Each Query

Codechef is an platform built to programmers compete against others in the community and to improve their knowledge by facing various challenges. Challenges are categorised on the basis of their difficulty level , if your rating is above 2000 you are in top tier i.e, Division 3 and if your rating is between 2000 and 1600 you will be in tier 2 i.e, Division 3 and if your rating is below that you will be in lowest tier i.e, Division 3. You can improve your rating by successful submission with minimum penalty.




Also Read : Neenade Naa song lyrics with English Translation

Leave a Comment