before the game start,they flip a coin to decide the starting player
the starting player choose a box & places the ball in it
if the ramesh starts he always places the ball in the box containing the biggest number
similarly suresh places the ball inthe box containing the smalllest number
after in each turn the player can move the ball one box to the left or one box to the right
ramesh plays such that he always moves the ball to the box containing a bigger number
suresh always moves the ball to the box containing a smaller number
ramesh plays in such a way that when the game ends,the number on the box which contains the ball is the biggest possible on the contry, suresh wants this number to be te smallest possible the result of the game is the number written on the box containing the ball after k turns write a program to determine the result of the game
i/p:2
4 3 0
4 1 9 5
4 3 1
4 1 9 5
o/P:
9
1
Comments
Leave a comment