結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
phtmscg
|
| 提出日時 | 2019-04-18 15:40:40 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 385 bytes |
| コンパイル時間 | 99 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-09-22 09:15:01 |
| 合計ジャッジ時間 | 3,799 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 6 RE * 22 |
ソースコード
N = int(input())
Q = [1]
t = 0
def bin1(n):
return bin(n).count("1")
def find(x,c):
global Q
global t
d = bin1(x)
if t == 0 and x == N:
t = c
if t == 0 and x-d not in Q and x-d >0:
Q.append(x-d)
find(x-d,c+1)
if t == 0 and x+d not in Q and x+d <N+1:
Q.append(x+d)
find(x+d,c+1)
find(1,1)
print(t if t != 0 else -1)
phtmscg