結果

問題 No.954 Result
ユーザー yansi819
提出日時 2024-05-11 17:40:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 81,592 KB
実行使用メモリ 53,812 KB
最終ジャッジ日時 2024-12-20 08:39:53
合計ジャッジ時間 2,830 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 7
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

a = [0] * 5
for i in range(5):
    a[i] = int(input())

Fib = [-1, 1, 1]
while Fib[-1] <= 10 ** 15:
    Fib.append(Fib[-1] + Fib[-2])

cnt = 0
if a[4] in Fib:
    pos = Fib.index(a[4])
    cnt += 1
    v = [a[4]]
    for i in range(3, -1, -1):
        v.append(a[i])
        #print(v, Fib[pos:pos + cnt + 1])
        if v == Fib[pos:pos + cnt + 1]:
            cnt += 1
        else:
            if i == 3 and a[4] == 1:
                pos += 1
                #print(v, Fib[pos:pos + cnt + 1])
                if v == Fib[pos:pos + cnt + 1]:
                    cnt += 1
                    continue
            break
print(cnt)
0