Submit | All submissions | Best solutions | Back to list |
UJ01 - Save the Scofield !! |
Scofield is excellent at math tables, so T-BAG decided to make things a bit more interesting. He gives two numbers A and B and merges the multiplication tables of A and B in sorted order (ascending order), removing the duplicates and thus creates Saratable of A and B (sounds interesting) and asks Scofield the Nth number in the Saratable.
Given A, B and N, Help Scofield in finding the Nth number in the Saratable, else he will be put into Camp 22 (North Korea) by the security officer T-BAG .
Input
First line contains number of test cases T. Each test case contains three integers A, B and N.
Output
For each test case print the Nth number of the Saratable.
Constraints
1 ≤ T ≤ 300000
1 ≤ A, B ≤ 1000
1 ≤ N ≤ 1000000000
Input: 4 3 5 2 3 5 3 2 3 4 2 3 6 Output: 5 6 6 9
Added by: | Ujjawal Dixit |
Date: | 2015-05-09 |
Time limit: | 1s-2.841s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments
|
||||||
2022-09-28 10:02:37
fortnite or pubg |
||||||
2019-03-29 07:00:29
Don't try this problem in python. It's giving TLE |
||||||
2015-12-07 00:04:55 Jacob Plachta
The "table of A" is the list of all multiples of A (A, 2A, 3A, ...). |
||||||
2015-08-28 14:28:01 biswas
@SRC: You don't need any array...just simple mathematics. |
||||||
2015-07-17 09:29:41 Shivaraj Lakka
problem is not clear!!! finally AC.. :-) Last edit: 2015-07-24 12:38:05 |
||||||
2015-07-02 06:31:56 kp
pen and paper rocks ! AC in one GO :P |
||||||
2015-06-27 15:25:10 Vipul Srivastava
Very nice question!! |
||||||
2015-06-23 19:24:13 Aman Agarwal
nice question bhai :) |
||||||
2015-06-18 09:30:46 black MaMbA
@HELLGEEK,would you please check submission id 14479575,is it wrong |
||||||
2015-06-17 00:48:05 SRC
What should the length of the array? Please help ! |