国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1714B - Remove Prefix

2023-08-19 14:13 作者:您是打尖兒還是住店呢  | 我要投稿

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

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

For the given s print the required number.

Input

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

Each test case is specified by a line that contains the only integer s

?(1≤s≤45).

Output

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

------------------------------------------------------------------

找到具有給定數(shù)字總和 s 的最小數(shù)字,使得其中的所有數(shù)字都不同(即所有數(shù)字都是唯一的)。

例如,如果s=20,則答案為389。這是所有數(shù)字都不同且數(shù)字之和為20(3+8+9=20)的最小數(shù)字。

對于給定的 s,打印所需的數(shù)字。

輸入

第一行包含一個整數(shù) t (1≤t≤45) — 測試用例的數(shù)量。

每個測試用例由包含唯一整數(shù) s 的行指定

? (1≤s≤45)。

輸出

打印 t 個整數(shù) — 給定測試用例的答案。

-------------------

配合數(shù)組進行處理要方便些,下面是代碼:


CF 1714B - Remove Prefix的評論 (共 條)

分享到微博請遵守國家法律
应城市| 桐庐县| 耒阳市| 谷城县| 城固县| 张家港市| 栾城县| 宁阳县| 乐至县| 新营市| 方正县| 南靖县| 汕尾市| 来凤县| 内黄县| 广河县| 达尔| 合川市| 永福县| 辉南县| 新竹市| 尚义县| 女性| 长顺县| 进贤县| 竹山县| 和平区| 安顺市| 海口市| 赞皇县| 永胜县| 乌兰浩特市| 绥滨县| 泾阳县| 怀宁县| 凤庆县| 深泽县| 洮南市| 巴东县| 镇安县| 呼伦贝尔市|