結果

問題 No.2416 vs Slime
ユーザー 👑 KA37RIKA37RI
提出日時 2023-08-12 14:41:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-19 20:58:20
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(H, A):
  slimes = {H: 1}
  ans = 0
  nxt = {}
  while slimes:
    for s in slimes:
      at = s // A
      if at > 0:
        if at not in nxt: nxt[at] = 0
        nxt[at] += slimes[s] * 2
      ans += slimes[s]
    slimes = nxt
    nxt = {}
  return ans
    
H, A = [int(x) for x in input().split()]
print(solve(H, A))
0