k-GCD
Practice
0 (0 votes)
Easy
Problem
61% Success 72 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You have given a code snippet -
int k = 0;
int gcd (int a, int b) {
if (b == 0)
return a;
else{
++k;
return gcd (b, a % b);
}
}
Find the minimum possible non-negative integers of \(a\) and \(b\) such that \(a > b\) and this code snippet outputs given \(k\) value.
INPUT FORMAT
-
The first line of the input contains a single integer \(T\) denoting the number of test cases.
-
Each test case consists of an integer \(k\).
OUTPUT FORMAT
Print two integers \(a\) and \(b\) separated by space such that \(a > b\).
CONSTRAINTS
\(1 \leq T \leq 10\)
\(1 \leq k \leq 50\)
Sample Input
2 1 2
Sample Output
2 1 3 2
Explanation
\(gcd(3, 2) \to gcd(2, 1) \to gcd(1, 0)\)
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:20
4 votes
Tags:
Basic ProgrammingOpenApprovedEasy
Points:20
11 votes
Tags:
Basic ProgrammingOpenApprovedEasyHash functionMathamatics
Points:20
7 votes
Tags:
SortingBasic ProgrammingEasyMathematicsOpenApprovedMathamatics
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor