結果
問題 | No.3 ビットすごろく |
ユーザー | kekure |
提出日時 | 2019-07-11 08:47:17 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 584 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 78,592 KB |
最終ジャッジ日時 | 2024-04-24 19:58:05 |
合計ジャッジ時間 | 4,156 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
51,968 KB |
testcase_01 | AC | 39 ms
52,224 KB |
testcase_02 | AC | 40 ms
51,968 KB |
testcase_03 | AC | 62 ms
65,792 KB |
testcase_04 | AC | 42 ms
53,120 KB |
testcase_05 | AC | 83 ms
70,912 KB |
testcase_06 | AC | 66 ms
66,304 KB |
testcase_07 | AC | 52 ms
61,440 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 82 ms
70,656 KB |
testcase_13 | AC | 63 ms
65,280 KB |
testcase_14 | AC | 122 ms
76,928 KB |
testcase_15 | AC | 133 ms
76,928 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 59 ms
64,640 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 38 ms
51,968 KB |
testcase_22 | AC | 114 ms
76,672 KB |
testcase_23 | AC | 142 ms
77,184 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 38 ms
52,096 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 39 ms
51,840 KB |
testcase_32 | WA | - |
ソースコード
n = int(input()) movable_number = [] move_min = -1 def go(i, move): global movable_number global move_min if i in movable_number: return if i > n: return if i == 0: return if i == n: if move_min == -1: move_min = move else: if move < move_min: move_min = move return movable_number.append(i) s = bin(i) num_one = s[2:].count('1') foward = i + num_one back = i - num_one go(foward, move + 1) go(back, move + 1) i = 1 go(1, 1) print(move_min)