結果

問題 No.2865 Base 10 Subsets 2
ユーザー ShirotsumeShirotsume
提出日時 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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
56,612 KB
testcase_01 AC 44 ms
56,692 KB
testcase_02 AC 43 ms
55,696 KB
testcase_03 AC 44 ms
55,336 KB
testcase_04 AC 43 ms
55,824 KB
testcase_05 AC 43 ms
56,176 KB
testcase_06 AC 44 ms
56,420 KB
testcase_07 AC 45 ms
56,660 KB
testcase_08 AC 43 ms
55,828 KB
testcase_09 AC 44 ms
56,240 KB
testcase_10 AC 44 ms
56,016 KB
testcase_11 AC 46 ms
56,864 KB
testcase_12 AC 44 ms
55,796 KB
testcase_13 AC 45 ms
55,892 KB
testcase_14 AC 44 ms
56,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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))))
0