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 HPof the patient and the final HP 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 after performing certain healing operations.
A healing operation can be defined as:
- Select an integer and an integer
- Update as:
Both Chansey and Bellossom heal optimally. Help Nurse Joy declare the winner of the training.
Input: Healer solution codechef
- First-line will contain , the number of test cases. Then the test cases follow.
- Each test case contains a single line of input, two integers .
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
Sample Input: Healer solution codechef
1 6 10
Sample Output: Healer solution codechef
Chansey starts healing. She selectsand . Therefore .
Now it’s Bellossom’s turn. She selectsand . Therefore . No matter what Bellossom chooses in this turn, Chansey is sure to win in the next turn.
Chansey selectsand such that . Therefore Chansey is the winner. Had Chansey not selected and optimally, Bellossom could have won.
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.
- Game of Primes solution codechef
- Books and Friends solution codechef
- Run It Back solution codechef
- Buy Masks solution codechef
- How I Met Your Mother solution codechef
Also Read : Neenade Naa song lyrics with English Translation