結果
問題 | No.2865 Base 10 Subsets 2 |
ユーザー |
|
提出日時 | 2024-08-30 21:44:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 684 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 82,608 KB |
実行使用メモリ | 56,864 KB |
最終ジャッジ日時 | 2024-08-30 21:44:30 |
合計ジャッジ時間 | 1,605 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
import sys, time, random from collections import deque, Counter, defaultdict def debug(*x):print('debug:',*x, file=sys.stderr) input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 n, k = input().split() D = len(n) k = int(k) - 1 ans = [] for i in range(D): cnt = 1 for j in range(i + 1, D): cnt *= int(n[j]) + 1 now = 0 ncnt = 0 for j in range(int(n[i]) + 1): if ncnt + cnt <= k: ncnt += cnt now += 1 else: break k -= ncnt ans.append(now) print(int(''.join(map(str, ans))))