CF BUDDY
← Problems·

1511B · GCD Length

1100 · constructive algorithms, math, number theory

Problem: You are given three integers aa, bb and cc.

Find two positive integers xx and yy (x>0x > 0, y>0y > 0) such that:

  • the decimal representation of xx without leading zeroes consists of aa digits;
  • the decimal representation of yy without leading zeroes consists of bb digits;
  • the decimal representation of gcd(x,y)gcd(x, y) without leading zeroes consists of cc digits.

gcd(x,y)gcd(x, y) denotes the greatest common divisor (GCD) of integers xx and yy.

Output xx and yy. If there are multiple answers, output any of them.

Input Format: The first line contains a single integer tt (1t2851 \le t \le 285) — the number of testcases.

Each of the next tt lines contains three integers aa, bb and cc (1a,b91 \le a, b \le 9, 1cmin(a,b)1 \le c \le min(a, b)) — the required lengths of the numbers.

It can be shown that the answer exists for all testcases under the given constraints.

Additional constraint on the input: all testcases are different.

Output Format: For each testcase print two positive integers — xx and yy (x>0x > 0, y>0y > 0) such that

  • the decimal representation of xx without leading zeroes consists of aa digits;
  • the decimal representation of yy without leading zeroes consists of bb digits;
  • the decimal representation of gcd(x,y)gcd(x, y) without leading zeroes consists of cc digits.

Note: In the example:

  1. gcd(11,492)=1gcd(11, 492) = 1
  2. gcd(13,26)=13gcd(13, 26) = 13
  3. gcd(140133,160776)=21gcd(140133, 160776) = 21
  4. gcd(1,1)=1gcd(1, 1) = 1

Sample Cases

Case 1

Input

4
2 3 1
2 2 2
6 6 2
1 1 1

Output

11 492
13 26
140133 160776
1 1

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback