Submit | All submissions | Best solutions | Back to list |
THREENUMBERS - nth number |
Given two numbers a and b, you have to find n-th number which is divisible by a or b.
Input
First line contains an integer T (≤ 100000), denoting number of test cases.
Second line contains 3 positive integers a, b and n. (a, b ≤ 10000, n ≤ 1000000000)
Output
Print n-th number in a new line.
Example
Input: 1 2 3 10 Output: 15
Added by: | surayans tiwari |
Date: | 2017-09-09 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | SELF |
hide comments
|
||||||
2024-01-18 13:41:32
@wisfaq Thanks! But why is that? |
||||||
2021-11-29 18:30:06
Simple logic solved both with and without binary search :) |
||||||
2021-08-03 00:01:41
good problem for me |
||||||
2018-10-24 07:22:22
nice problem. |
||||||
2018-09-20 22:18:13
No need of binary search. Simple logic, AC in first go. |
||||||
2018-08-14 08:05:51
incorrect testCases... thanks @wisfaq for figuring it out. |
||||||
2018-06-12 21:36:54
Kudos to wisfaq for figuring out that the missing testcase requires reprinting the last result. Completely lame from psetter to leave something like this for solvers to handle. -1 |
||||||
2018-01-08 06:31:21
Binary Search :-) |
||||||
2017-12-24 21:04:44 Nishant Gupta
Some input files seem to be broken which will cause Fast I/O yielding TLE. Use scanf for input. |
||||||
2017-11-05 19:39:58
very good problem :-) |