結果

問題 No.3 ビットすごろく
ユーザー tomiyancetomiyance
提出日時 2019-11-14 07:36:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 412 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,788 KB
実行使用メモリ 11,416 KB
最終ジャッジ日時 2023-10-21 19:54:42
合計ジャッジ時間 3,694 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,084 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 WA -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

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