最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

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

分享到微博請遵守國家法律
富宁县| 桐梓县| 邯郸县| 江油市| 叶城县| 朝阳区| 丹东市| 城固县| 浠水县| 台前县| 郸城县| 蕲春县| 蒙自县| 南召县| 育儿| 乌审旗| 江陵县| 安徽省| 延津县| 封丘县| 五峰| 旌德县| 西乌| 灵山县| 河间市| 吐鲁番市| 凤阳县| 昆山市| 新龙县| 民勤县| 汶川县| 广灵县| 界首市| 威信县| 怀宁县| 开鲁县| 明星| 台北县| 炉霍县| 渝中区| 黔南|