結果

問題 No.3 ビットすごろく
ユーザー tomiyance
提出日時 2019-11-14 07:36:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 412 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-09-21 21:19:50
合計ジャッジ時間 3,804 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 4 RE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
N = int(input())
F = [[0 for j in range(2)] for i in range(N+1)]
for i in range(1,N+1):
  F[i][0] = format(i,'b').count('1')
F[1][1] = 1
def check(F, p):
  n = F[p][0]
  c = F[p][1]
  if p - n > 0 and F[p - n][1] == 0:
    F[p - n][1] = c + 1
    check(F, p - n)
  if p + n < N + 2 and F[p + n][1] == 0 :
    F[p + n][1] = c + 1
    check(F, p + n)
  return F
R = check(F, 1)
print(R[N][1])
0