結果

問題 No.954 Result
コンテスト
ユーザー えりす
提出日時 2026-06-06 20:20:13
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 698 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 82 ms
コンパイル使用メモリ 64,780 KB
実行使用メモリ 53,828 KB
最終ジャッジ日時 2026-10-17 03:40:41
合計ジャッジ時間 3,683 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 7
other AC * 30 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
def solve():
    a = [int(sys.stdin.readline()) for _ in range(5)]
    f = [1, 1]
    while f[-1] + f[-2] <= 10 ** 15:
        f.append(f[-1] + f[-2])
    s = set(f)
    ok_pair = set()
    for i in range(len(f) - 1):
        ok_pair.add((f[i], f[i + 1]))
    for n in range(5, 0, -1):
        ok = 1
        if n == 1:
            if a[4] not in s:
                ok = 0
        else:
            for i in range(n - 1):
                x = a[4 - i]
                y = a[4 - i - 1]
                if (x, y) not in ok_pair:
                    ok = 0
                    break
        if ok:
            print(n)
            return
    print(0)

if __name__ == '__main__':
    solve()
0