結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
maburoe
|
| 提出日時 | 2019-05-22 13:26:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 484 bytes |
| コンパイル時間 | 72 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-09-17 09:29:49 |
| 合計ジャッジ時間 | 1,791 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 15 |
ソースコード
goal = int(input())
# goal_1bit_num = bin(goal)
# print(goal_1bit_num.count('1'))
count = 1
position = 1
used = {1}
while position in range(1, goal):
position_bin = bin(position)
if position + position_bin.count('1') <= goal:
position = position + position_bin.count('1')
else:
position = position - position_bin.count('1')
if position in used or position < 1:
count = -1
break
used.add(position)
count += 1
print(count)
maburoe