結果
問題 | No.3 ビットすごろく |
ユーザー |
![]() |
提出日時 | 2020-08-25 02:08:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-06 10:57:49 |
合計ジャッジ時間 | 2,352 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 33 |
ソースコード
m=int(input()) from collections import deque st=[-1]*(m+1) st[1]=1 q=deque() q.append(1) while len(q)!=0: cur = q.popleft() curbc=bc(cur) if cur+curbc<=m: if st[cur+curbc]==-1: st[cur+curbc]=st[cur]+1 q.append(cur+curbc) if cur-curbc>=1 and st[cur-curbc]==-1: st[cur-curbc]=st[cur]+1 q.append(cur-curbc) print(st[m])