Two Printers

Problem #22

Tags: puzzle arithmetic c-1 c-0 interviews

Who solved this?

Also available in: Spanish Russian

My colleague have retold me this puzzle after visiting an interview at local office of Oracle company. I hope I remember it correctly.

John and Mary founded J&M publishing house and bought two old printers to equip it.

Now they have their first commercial deal - to print a document consisting of N pages.

It appears that printers work at different speed. One produces a page in X seconds and other does it in Y seconds.

So now company founders are curious about minimum time they can spend on printing the whole document with two printers.

Input data contains number of test cases in the first line.
Then test-cases will follow, each in separate line.
Each testcase contains three integer values - X Y N, where N will not exceed 1,000,000,000.
Answer should contain minumum printing times for each of testcases, separated by spaces.

Example:

input data:
2
1 1 5
3 5 4

answer:
3 9
You need to login to get test data and submit solution.