During the game, the player serving the ball starts a play. The server strikes the ball then the recipient makes a return by hitting the ball back. From that point, the server and beneficiary should on the other hand make a return until one of them doesn't make a return. The person wh
Correct answer will be upvoted else Multiple Downvoted. Computer science.
During the game, the player serving the ball starts a play. The server strikes the ball then the recipient makes a return by hitting the ball back. From that point, the server and beneficiary should on the other hand make a return until one of them doesn't make a return.
The person who doesn't make a return loses this play. The champ of the play begins the following play. Alice begins the primary play.
Alice has x endurance and Bob has y. To hit the ball (while serving or returning) every player burns through 1 endurance, so on the off chance that they don't have any endurance, they can't return the ball (and lose the play) or can't serve the ball (for this situation, the other player serves the ball all things being equal). On the off chance that the two players run out of endurance, the game is finished.
Here and there, it's deliberately ideal not to return the ball, lose the current play, however save the endurance. Despite what might be expected, when the server starts a play, they need to hit the ball, if they have some endurance left.
Both Alice and Bob play ideally and need to, right off the bat, augment their number of wins and, also, limit the number of wins of their rival.
Compute the subsequent number of Alice's and Bob's successes.
Input
The primary line contains a solitary integer t (1≤t≤104) — the number of experiments.
The sole line of each experiment contains two integers x and y (1≤x,y≤106) — Alice's and Bob's underlying endurance.
Output
For each experiment, print two integers — the subsequent number of Alice's and Bob's successes, if the two of them play ideally
Step by step
Solved in 5 steps with 1 images