結果

問題 No.954 Result
ユーザー kekure
提出日時 2020-02-13 11:52:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-04 12:41:34
合計ジャッジ時間 2,229 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 7
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

F = [1, 1]
n = 1
limit = 10 ** 15
i = 2
while True:
    v = F[i - 1] + F[i - 2]
    if v > limit:
        break
    F.append(v)
    i += 1

input = sys.stdin.readlines()
A = [int(s) for s in input]
A.reverse()
k = len(A)
ans = 0


if  k >= 2 and A[0] == 1 and A[1] == 2:
    x = 2
    y = 3
    ans = 2
    while x < k:
        if not A[x] == F[y]:
             break
        ans += 1
        x += 1
        y += 1
else:
    i = 0
    if A[i] in F:
        j = F.index(A[i])
        t = 0
        while i < k and j < len(F) and A[i] == F[j]:
            ans += 1
            i += 1
            j += 1

        ans = max(ans, t)


print(ans)







0