Bob and Alice decided that problem $$X$$ needs at least $$N$$ distinct solutions to be written. It does not matter how many solutions each of them will write, they need to write at least $$N$$ solutions in total.
Bob needs $$t_1$$ units of time to write a solution, and Alice needs $$t_2$$ units of time. They start to work simultaneously at time $$0$$. For example, Bob finishes writing his first solution at time $$t_1$$, his second solution at $$2*t_1$$, and so on.
Bob and Alice are working using the same algorithm. Each time Bob or Alice finishes writing a solution, he checks on how many solutions have already been written up to the current time moment $$t$$. If the number of such solutions is strictly less than $$N$$, then he starts writing the next solution. If a member began working on a problem, he does not stop working under any circumstances and he will surely finish it.
Bob and Alice realize that if they act on this algorithm, they will not necessarily write exactly $$N$$ solutions in total.
Considering that Bob and Alice work non-stop, find how many solutions they wrote in total and the moment when the latest solution was finished.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- The first line of each test case contains three space-separated integers $$N$$, $$t_1$$ and $$t_2$$.
Output format
For each test case, print two integers $$m$$ and $$f$$, where $$m$$ is the number of written solutions and $$f$$ is the moment when the last solution was finished. Output for each test case should be in a new line.
Constraints
3 2 1 2 2 2 4 4 5 5
3 2 3 4 4 10
For the first test case, Bob will finish writing his first solution at $$t=1$$. At this moment, only $$1$$ solution is completed. Therefore, he will start writing his second solution and finish at $$t=2$$. At this moment, Alice will also finish writing her first solution. Thus, total $$3$$ solutions will be written.
For the third test case, both Bob and Alice will end up writing exactly $$4$$ solutions at $$t=10$$.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor