結果

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

ソースコード

diff #

import sys

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

input = sys.stdin.readlines()
A = [int(s) for s in input]
A.reverse()
k = len(A)
ans = 0
for i in range(k):
    t = 0
    tt = 0
    if A[i] in F:
        if A[i] == 1:
            xx = i
            yy = F.index(A[i]) + 1
            while xx < k and yy < len(F) and A[xx] == F[yy]:
                tt += 1
                xx += 1
                yy += 1

        xx = i
        yy = F.index(A[i])
        t = 0
        while xx < k and yy < len(F) and A[xx] == F[yy]:
            t += 1
            xx += 1
            yy += 1

        ans = max(ans, t, tt)


print(ans)







0