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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question

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

 

 

Expert Solution
steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole