No.2934 Digit Sum
レベル :
/ AI推定難易度 : 1900
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 14
作問者 :
tnodino
/ テスター :
nouka28
kusirakusira
👑
loop0919
ice_ut
amesyu
hirayuu_yc
uruzunyaa
タグ : / 解いたユーザー数 14
作問者 :
tnodino
/ テスター :
kusirakusira
👑
問題文最終更新日: 2024-10-12 07:31:56
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
第3回緑以下コンテスト エキストラ
(順位表)
の他の問題:
Problem Statement
Among the positive integers whose sum of digits is at most $N$, find the $K$-th smallest one.
Constraints
- $1 \le N, K \le 10^{18}$
- All inputs are integers.
- It is guaranteed that the answer has at most $10^5$ digits.
Input
$N\ K$
Output
Output the answer.
Sample
Sample 1
Input
3 10
Output
100
The positive integers whose sum of digits is at most 3 are, in ascending order, 1, 2, 3, 10, 11, 12, 20, 21, 30, 100, 101 ...
The 10-th smallest positive integer is 100.
Sample 2
Input
33 1000000000000000000
Output
1020002210002200600501111300120
The answer may not fit in a 64-bit integer.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。