結果

問題 No.3 ビットすごろく
ユーザー ebicochineal
提出日時 2017-01-24 02:11:00
言語 Python2
(2.7.18)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 180 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-07-01 08:16:30
合計ジャッジ時間 1,586 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N=input()+1
a,l,c,r=N,[1],0,{}
while c<a:
 q=l;l=[];c+=1
 for i in q:
  if i==N-1:a=c
  if not i in r:
   r[i]=1;b=bin(i).count('1');l+=[i+b]*(i+b<N)+[i-b]*(i-b>0)
print[-1,a][a<N]
0