結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
ondy_candy
|
| 提出日時 | 2016-09-24 03:00:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 400 bytes |
| コンパイル時間 | 226 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-17 20:20:52 |
| 合計ジャッジ時間 | 2,582 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 15 |
ソースコード
# coding: utf-8
n = int(input())
position = 1
history = []
result = -1
while True:
history.append(position)
if position == n:
result = len(history)
break
steps = str(format(position, 'b')).count('1')
if position + steps > n:
position -= steps
else:
position += steps
if position in history:
break
print(result)
ondy_candy