結果
問題 |
No.3 ビットすごろく
|
ユーザー |
![]() |
提出日時 | 2017-07-01 16:00:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 468 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-10-05 04:47:41 |
合計ジャッジ時間 | 6,867 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 11 RE * 15 OLE * 2 |
ソースコード
import sys def popcnt(n): return len(list(filter(lambda c: c == '1', list(str(bin(n)))))) def mov(e, p = 1, t = []): if p in t or p > e or p < 1: print(e, p, t, "E") return -1 q = popcnt(p) t.append(p) if p == e: print(len(t)) sys.exit(0) r = list(filter(lambda i: i >= 0, [mov(e, p + q, t), mov(e, p - q, t)])) if len(r) > 0: return min(r) else: return -1 print(mov(int(input())))