Lohia , Gosu and Prince are footballers. Lohia and Gosu are strikers while Prince is a goalkeeper. You as the coach held a practice session of penalty shootouts to improve the performance of the strikers . Your task is to find the maximum goal scorer between the two.
Lohia, Gosu and Prince energy is denoted by X, Y and Z respectively. For every goal scored the energy of the respective player is decreased by 1 and after every save Prince energy is decreased by 1. Strikers will be able to score the goal if Prince energy is a factor of their energy otherwise not.
The session ends when Prince's energy reaches 1.
Assume same player can try for goals repeatedly and they both try to increase number of goals in totality. Lohia being a junior player is always favoured for penalty kick.
The first line of input contains an integer T denoting the number of test cases. Each test case contains energy 3 integers X, Y & Z , denoting the energies respectively.
For each test case print the number of goals scored by Lohia and Gosu respectively.
1<= T <=10
1<= X , Y ,Z <=105
4 9 5
13 10 7
Goal will not be scored because Z is not a factor of X and Y hence (X-4 , Y-9 , Z-4). Now goal will be scored by (X=1) X-3 , Y-9 , Z-4 ---> X-3 , Y-9 , Z-3 ---> (X=2)X-2, Y-9 , Z-3 ---> (X=2 , Y=1)X-2 , Y-8 , Z-3 ---> X-2, Y-8 , Z-2 ---> (X=3 , Y=1)X-1, Y-8 , Z-2 ---> (X=3, Y=2)X-1 , Y-7 , Z-1. Now the session will end because Prince’s energy reaches 1.
Since X is a prime number goal by X will never be scored therefore only Y will be able to score.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.