結果
問題 |
No.320 眠れない夜に
|
ユーザー |
![]() |
提出日時 | 2020-06-24 22:21:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 326 bytes |
コンパイル時間 | 84 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-03 20:23:28 |
合計ジャッジ時間 | 2,382 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 WA * 11 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() n,m=map(int,input().split()) A=[1,1] for i in range(n-2): A.append(A[-1]+A[-2]) import bisect ans=0 nn=A[-1] while nn-m>0: d=nn-m if d==1: m+=1 ans+=1 break else: m+=A[bisect.bisect_left(A,d)-1] ans+=1 if nn!=m: print(-1) else: print(ans)