五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
五常市| 息烽县| 麻江县| 华容县| 卓资县| 南皮县| 卫辉市| 洛南县| 榆树市| 克山县| 湖南省| 郸城县| 临朐县| 甘孜县| 广汉市| 广宗县| 泗洪县| 桐柏县| 益阳市| 怀化市| 宁明县| 理塘县| 长顺县| 绥阳县| 兴仁县| 阆中市| 岳池县| 嘉黎县| 内江市| 龙井市| 莆田市| 休宁县| 洛宁县| 遂昌县| 宁城县| 高雄县| 潞西市| 沾化县| 巢湖市| 洪江市| 莱芜市|