結果

問題 No.2416 vs Slime
ユーザー FromBooska
提出日時 2023-08-18 20:24:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 55,040 KB
最終ジャッジ日時 2024-11-28 04:12:39
合計ジャッジ時間 3,332 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache
H, A = map(int, input().split())
from math import ceil, floor

import sys
sys.setrecursionlimit(10**7)

@lru_cache
def dfs(num):
    if num == 0:
        return 0
    elif num == 1:
        return 1
    else:
        return dfs(num//A)*2+1
    
print(dfs(H))
0