結果
問題 |
No.3 ビットすごろく
|
ユーザー |
|
提出日時 | 2018-10-01 11:35:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 498 bytes |
コンパイル時間 | 102 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 19,236 KB |
最終ジャッジ日時 | 2024-10-12 09:35:04 |
合計ジャッジ時間 | 27,702 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 TLE * 1 -- * 17 |
ソースコード
N=int(input()) a=1 b=1 c=[1] d=[] if N==1: print(1) else: while b!=N: for i in range(0,len(c)): e=bin(c[i]).count("1") p=c[i]+e q=c[i]-e if p<=N: c.append(p) if q>0: c.append(q) a+=1 c=list(set(c)) if N in c: print(a) break if c==d: print(-1) break else: d=c d=list(set(d))