Skip to main content

Posts

Showing posts from May, 2021

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  N + 2 N + 2  tiles numbered from  0 0  to  N + 1 N + 1  from left to right. There is a hole on tile number  x x . You hit the ball standing on tile  0 0 . When you hit the ball, it bounces at lengths of  k k , i.e. the tiles covered by it are  0 , k , 2 k , … 0 , k , 2 k , … , and so on until the ball passes tile  N + 1 N + 1 . If the ball doesn't enter the hole in the first trial, you try again but this time standing on the tile  N + 1 N + 1 . When you hit the ball, it bounces at lengths of  k k , i.e. the tiles covered by it are  ( N + 1 ) , ( N + 1 − k ) , ( N + 1 − 2 k ) , … ( N + 1 ) , ( N + 1 − k ) , ( N + 1 − 2 k ) , … , and so on until the ball passes tile  0 0 . 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 cont