結果

問題 No.954 Result
ユーザー tcltktcltk
提出日時 2021-01-16 09:37:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 1,403 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 83,400 KB
最終ジャッジ日時 2023-08-18 06:06:07
合計ジャッジ時間 12,321 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 263 ms
82,952 KB
testcase_01 AC 255 ms
83,204 KB
testcase_02 AC 245 ms
83,072 KB
testcase_03 AC 263 ms
83,400 KB
testcase_04 AC 246 ms
83,268 KB
testcase_05 AC 250 ms
83,356 KB
testcase_06 AC 255 ms
82,968 KB
testcase_07 AC 267 ms
83,280 KB
testcase_08 AC 259 ms
83,336 KB
testcase_09 AC 250 ms
83,368 KB
testcase_10 AC 265 ms
82,972 KB
testcase_11 AC 252 ms
83,184 KB
testcase_12 AC 250 ms
83,244 KB
testcase_13 AC 247 ms
83,100 KB
testcase_14 AC 251 ms
83,252 KB
testcase_15 AC 250 ms
83,000 KB
testcase_16 AC 262 ms
83,064 KB
testcase_17 AC 266 ms
83,096 KB
testcase_18 AC 265 ms
83,292 KB
testcase_19 AC 258 ms
83,224 KB
testcase_20 AC 276 ms
83,288 KB
testcase_21 AC 274 ms
83,044 KB
testcase_22 AC 255 ms
82,992 KB
testcase_23 AC 260 ms
82,988 KB
testcase_24 AC 255 ms
83,236 KB
testcase_25 AC 251 ms
83,244 KB
testcase_26 AC 246 ms
83,264 KB
testcase_27 AC 263 ms
83,396 KB
testcase_28 AC 266 ms
83,196 KB
testcase_29 AC 249 ms
82,996 KB
testcase_30 AC 258 ms
82,968 KB
testcase_31 AC 253 ms
82,972 KB
testcase_32 AC 260 ms
83,348 KB
testcase_33 AC 249 ms
83,304 KB
testcase_34 AC 254 ms
83,152 KB
testcase_35 AC 258 ms
83,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """233
# 144
# 89
# 55
# 34
# """
# sys.stdin = io.StringIO(_INPUT)


def main():
    a = list(reversed([int(input()) for _ in range(5)]))

    F = [1, 1, 2, 3, 5, 8]
    if a[0] == 1:
        n1 = 5
        for i in range(5):
            if a[i] != F[i]:
                n1 = i
                break
        n2 = 5
        for i in range(5):
            if a[i] != F[1+i]:
                n2 = i
                break
        print(max(n1, n2))

    else:
        k = 2
        while True:
            while len(F) - 1 < k:
                F.append(F[-2] + F[-1])
            if a[0] == F[k]:
                n = 5
                for i in range(5):
                    while len(F) - 1 < k+i:
                        F.append(F[-2] + F[-1])
                    if a[i] != F[k+i]:
                        n = i
                        break
                print(n)
                break
            elif a[0] < F[k]:
                print(0)
                break
            k += 1

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