結果
| 問題 | No.3 ビットすごろく | 
| コンテスト | |
| ユーザー |  compass19 | 
| 提出日時 | 2016-06-02 03:03:06 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 764 bytes | 
| コンパイル時間 | 379 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,392 KB | 
| 最終ジャッジ日時 | 2024-10-08 05:16:54 | 
| 合計ジャッジ時間 | 13,297 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 32 WA * 1 | 
ソースコード
N = int(input()) def step(num,k=0,result=0): while 2**k <= num: k = k + 1 while k != -1: if 2**k <= num: num = num -2**k result = result + 1 k = k-1 return result square, prev = [1], [-1] def start(): global square, prev head, tail = 0, 1 while head < tail: now = square[head] s = step(now) if now-s > 0: if now-s not in square: square.append(now-s) prev.append(head) tail = tail + 1 if now+s <= N: if now+s not in square: square.append(now+s) prev.append(head) tail = tail + 1 if now+s == N: return True head = head + 1 return False def root(result=1): global square, prev k = prev[-1] while k != -1: result = result + 1 k = prev[k] print(result) if start(): root() else: print(-1)
