NINJA3 - STUNNING GCD
You are given three numbers N, a, b. You can build a number X by repeating N 'a' times and the number Y by repeating N 'b' times. Now that you have the numbers X and Y, determine the GCD of the two numbers X and Y.
Input format:
The first line contains an integer T, the number of test cases.
Then for each test case, there are three integers in each line: N, a, b.
Output format:
Print the required answer for each test case in a single line.
Constraints:
1 <= T <= 100
1 <= N, a, b <= 10^18
Sample:
Input: 1 123 2 3 Output: 123
hide comments
[Lakshman]:
2016-02-23 08:36:42
I have doubt what will be the output if input is 123 1000000000 1000000000000000000?
|
|
farhan764:
2016-02-23 07:45:13
N 'a' times mean concatenates N 'a' times |
|
Shivam Garg:
2016-02-22 21:34:18
does repeating N 'a' times mean X=N*a , or concatenating N 'a' times?
|
|
Ankit:
2016-02-21 09:25:38
the answers need to be in the single line, or on separate lines ? Little confusing. Last edit: 2016-02-21 09:25:47 |
|
farhan764:
2016-02-21 08:30:08
@dungeon_master:=> would u plz provide output of these test cases |
|
Siddharth Singh:
2016-02-21 07:12:09
Easy , AC in 1 Go
|
|
azam_9:
2016-02-20 16:01:34
dont knw y i m getting WA..plz give some tricky test cases.
|
Added by: | mombassa |
Date: | 2016-02-17 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |