Numbers II
Practice
4.3 (18 votes)
Algorithms
Binary search
Greatest common divisor
Medium
Searching
Gcd
Problem
13% Success 13869 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given two numbers a and b, you have to find the \(N^{th}\) number which is divisible by a or b.
Input :
First line consists of an integer T, denoting the number of test cases.
Second line contains three integers a, b and N .
Output :
For each test case, print the \(N^{th}\) number in a new line.
Constraints :
\(1 \le t \le 10^5\)
\(1 \le a ,b \le 10^4\)
\(1 \le N \le 10^9\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
24 votes
Tags:
AlgorithmsApprovedData StructuresMediumOpenSorting
Points:30
5 votes
Tags:
AlgorithmsApprovedBinary SearchMediumOpenSorting
Points:30
7 votes
Tags:
AlgorithmsBinary Search
Editorial