1511B.md (1771B)
1 Source: https://codeforces.com/problemset/problem/1511/B 2 3 B. GCD Length 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given three integers $a$, $b$ and $c$. 22 23 Find two positive integers $x$ and $y$ ($x \gt 0$, $y \gt 0$) such that: 24 25 * the decimal representation of $x$ without leading zeroes consists of $a$ digits; 26 * the decimal representation of $y$ without leading zeroes consists of $b$ digits; 27 * the decimal representation of $gcd(x, y)$ without leading zeroes consists of $c$ digits. 28 29 $gcd(x, y)$ denotes the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers $x$ and $y$. 30 31 Output $x$ and $y$. If there are multiple answers, output any of them. 32 33 Input 34 35 The first line contains a single integer $t$ ($1 \le t \le 285$) — the number of testcases. 36 37 Each of the next $t$ lines contains three integers $a$, $b$ and $c$ ($1 \le a, b \le 9$, $1 \le c \le min(a, b)$) — the required lengths of the numbers. 38 39 It can be shown that the answer exists for all testcases under the given constraints. 40 41 Additional constraint on the input: all testcases are different. 42 43 Output 44 45 For each testcase print two positive integers — $x$ and $y$ ($x \gt 0$, $y \gt 0$) such that 46 47 * the decimal representation of $x$ without leading zeroes consists of $a$ digits; 48 * the decimal representation of $y$ without leading zeroes consists of $b$ digits; 49 * the decimal representation of $gcd(x, y)$ without leading zeroes consists of $c$ digits. 50 51 Example 52 53 Input 54 55 ``` 56 4 57 2 3 1 58 2 2 2 59 6 6 2 60 1 1 1 61 ``` 62 63 Output 64 65 ``` 66 11 492 67 13 26 68 140133 160776 69 1 1 70 ``` 71 72 Note 73 74 In the example: 75 76 1. $gcd(11, 492) = 1$ 77 2. $gcd(13, 26) = 13$ 78 3. $gcd(140133, 160776) = 21$ 79 4. $gcd(1, 1) = 1$