CF1714C.Minimum Varied Number

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Find the minimum number with the given sum of digits ss such that all digits in it are distinct (i.e. all digits are unique).

For example, if s=20s=20, then the answer is 389389. This is the minimum number in which all digits are different and the sum of the digits is 2020 (3+8+9=203+8+9=20).

For the given ss print the required number.

找出满足给定数字和 ss 的最小正整数,且该数的所有数字互不相同(即所有数字均唯一)。

例如,若 s=20s=20,则答案为 389389。这是所有数字互不相同且各位数字之和为 2020(3+8+9=203+8+9=20)的最小正整数。

对于给定的 ss,输出所要求的数。

输入格式

The first line contains an integer tt (1≤t≤451 \le t \le 45) — the number of test cases.

Each test case is specified by a line that contains the only integer ss (1≤s≤451 \le s \le 45).

第一行包含一个整数 tt(1≤t≤451 \le t \le 45)—— 测试用例的数量。

每个测试用例由一行指定,该行仅包含一个整数 ss(1≤s≤451 \le s \le 45)。

输出格式

Print tt integers — the answers to the given test cases.

输出 tt 个整数——即给定测试用例的答案。

输入输出样例

  • 输入#1

    4
    20
    8
    45
    10

    输出#1

    389
    8
    123456789
    19

输入解题思路,AI测评打分。不知道怎么写?

首页