Golf | LKDNGOLF | May Challenge 2021 Division 2 & 3 | Codechef Solution | Latest Video Solution code
It's a lockdown. You’re bored in your house and are playing golf in the hallway.
The hallway has tiles numbered from to from left to right. There is a hole on tile number . You hit the ball standing on tile . When you hit the ball, it bounces at lengths of , i.e. the tiles covered by it are , and so on until the ball passes tile .
If the ball doesn't enter the hole in the first trial, you try again but this time standing on the tile . When you hit the ball, it bounces at lengths of , i.e. the tiles covered by it are , and so on until the ball passes tile .
Find if the ball will enter the hole, either in its forward journey or backward journey.
Note: The input and output of this problem are large, so prefer using fast input/output methods.
Input
- The first line contains an integer , the number of test cases. Then the test cases follow.
- The only line of each test case contains three integers .
Output
Output in a single line, the answer, which should be "YES" if the ball enters the hole either in the forward or backward journey and "NO" if not.
You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).
Constraints
Subtasks
Subtask #1 (10 points):
Subtask #2 (90 points): original constraints
Sample Input
3
5 4 2
5 3 2
5 5 2
Sample Output
YES
NO
NO
For Solution
Golf | LKDNGOLF | May Challenge 2021 Division 2 & 3 | Codechef Solution | Latest Video Solution code
Fullfill the Given Condition, and DM the Screenshot on Telegram or Instagram, We will provide the Code there, we are not Charging any kind of Money, so Keep in Mind. Don't Give Money to Anyone
Follow All :-
SUBSCRIBE The Youtube Channel and Press the Bell Icon Website :- https://codedelhi.blogspot.com Telegram :- https://t.me/EngineerDelhi Facebook :- https://www.facebook.com/EngineerDelhi Instagram :- https://www.instagram.com/engineerdelhi
Explanation
In each test case, the tiles covered by the ball for and are in the forward journey and in the backward journey.
Therefore, the answer for the first test case is "YES" since the ball falls in the position of the hole at tile . But the answer for test cases and is "NO" since the ball does not fall in the position of the hole.