結果

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

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    aa=[int(input()) for _ in range(5)]
    ans=0
    if aa[3:]==[1,1]:
        ans=1
        aa.pop()
    fibo=[1,1]
    while fibo[-1]<aa[-1]:
        fibo.append(fibo[-1]+fibo[-2])
    while aa:
        a=aa.pop()
        if a==fibo[-1]:
            ans+=1
            fibo.append(fibo[-1] + fibo[-2])
        else:
            break
    print(ans)

main()
0