309229: CF1647A. Madoka and Math Dad
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Madoka and Math Dad
题意翻译
给定正整数 $n$,求最大的数 $k$,使得: - $k$ 的数字和为 $n$。 - $k$ 的每一位都不等于 $0$。 - $k$ 的任意相邻两位都不相同。 多测,$n\le 1000$。题目描述
Madoka finally found the administrator password for her computer. Her father is a well-known popularizer of mathematics, so the password is the answer to the following problem. Find the maximum decimal number without zeroes and with no equal digits in a row, such that the sum of its digits is $ n $ . Madoka is too tired of math to solve it herself, so help her to solve this problem!输入输出格式
输入格式
Each test contains multiple test cases. The first line contains a single integer $ t $ ( $ 1 \le t \le 1000 $ ) — the number of test cases. Description of the test cases follows. The only line of each test case contains an integer $ n $ ( $ 1 \le n \le 1000 $ ) — the required sum of the digits.
输出格式
For each test case print the maximum number you can obtain.
输入输出样例
输入样例 #1
5
1
2
3
4
5
输出样例 #1
1
2
21
121
212