結果

問題 No.320 眠れない夜に
ユーザー takakintakakin
提出日時 2020-06-24 22:21:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 8,308 KB
最終ジャッジ日時 2023-09-16 21:23:51
合計ジャッジ時間 1,942 ms
ジャッジサーバーID
(参考情報)
judge12 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,096 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 16 ms
8,100 KB
testcase_04 AC 16 ms
8,100 KB
testcase_05 AC 16 ms
8,204 KB
testcase_06 AC 16 ms
8,128 KB
testcase_07 AC 16 ms
8,244 KB
testcase_08 WA -
testcase_09 AC 17 ms
8,132 KB
testcase_10 WA -
testcase_11 AC 16 ms
8,056 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 16 ms
8,132 KB
testcase_16 AC 16 ms
8,120 KB
testcase_17 AC 16 ms
8,196 KB
testcase_18 AC 16 ms
8,100 KB
testcase_19 AC 16 ms
8,252 KB
testcase_20 AC 16 ms
8,200 KB
testcase_21 AC 16 ms
8,164 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 17 ms
8,124 KB
testcase_25 WA -
testcase_26 AC 16 ms
8,060 KB
testcase_27 WA -
testcase_28 AC 16 ms
8,196 KB
testcase_29 AC 16 ms
8,104 KB
testcase_30 AC 16 ms
8,232 KB
testcase_31 AC 16 ms
8,104 KB
testcase_32 AC 16 ms
8,052 KB
testcase_33 AC 16 ms
8,092 KB
testcase_34 AC 16 ms
8,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0