結果
| 問題 | No.954 Result |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-06-06 20:20:13 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 698 bytes |
| 記録 | |
| コンパイル時間 | 1,430 ms |
| コンパイル使用メモリ | 84,608 KB |
| 実行使用メモリ | 52,224 KB |
| 最終ジャッジ日時 | 2026-06-06 20:20:17 |
| 合計ジャッジ時間 | 3,148 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 7 |
| other | AC * 29 |
ソースコード
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()