結果

問題 No.2363 k-bonacci
ユーザー rin204
提出日時 2023-08-05 19:27:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 179 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 64,768 KB
最終ジャッジ日時 2024-10-15 16:34:43
合計ジャッジ時間 3,872 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

for k in range(2, 70):
    A = [0] * (k - 1) + [1]
    while A[-1] < n:
        A.append(sum(A[-k:]))

    if n in A:
        print(k)
        exit()

print(-1)
0