結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-09 02:01:52 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 421 bytes |
| 記録 | |
| コンパイル時間 | 553 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 21,760 KB |
| 最終ジャッジ日時 | 2026-05-23 15:38:40 |
| 合計ジャッジ時間 | 8,854 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 29 |
ソースコード
def step(num):
res = 0
while True:
res += num % 2
num //= 2
if num == 0:
break
return res
N = int(input())
m = 1
cnt = 0
while True:
next = step(m)
cnt += 1
if N < m + next:
m -= next
elif N > m + next:
m += next
else:
m += next
cnt += 1
print(cnt)
break
if cnt > N*N:
print(-1)
break