結果

問題 No.2363 k-bonacci
ユーザー ntudantuda
提出日時 2023-07-01 10:31:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2023-09-22 04:30:57
合計ジャッジ時間 5,718 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
76,960 KB
testcase_01 AC 92 ms
71,712 KB
testcase_02 AC 92 ms
71,872 KB
testcase_03 AC 96 ms
71,716 KB
testcase_04 AC 93 ms
71,588 KB
testcase_05 AC 93 ms
71,436 KB
testcase_06 AC 97 ms
76,660 KB
testcase_07 AC 98 ms
76,956 KB
testcase_08 AC 99 ms
77,000 KB
testcase_09 AC 100 ms
76,892 KB
testcase_10 AC 90 ms
71,820 KB
testcase_11 AC 93 ms
71,328 KB
testcase_12 AC 93 ms
71,584 KB
testcase_13 AC 99 ms
76,908 KB
testcase_14 AC 99 ms
76,988 KB
testcase_15 AC 97 ms
77,056 KB
testcase_16 AC 100 ms
76,908 KB
testcase_17 AC 97 ms
77,032 KB
testcase_18 AC 99 ms
77,012 KB
testcase_19 AC 91 ms
71,824 KB
testcase_20 AC 92 ms
71,684 KB
testcase_21 AC 91 ms
71,820 KB
testcase_22 AC 93 ms
71,540 KB
testcase_23 AC 93 ms
71,648 KB
testcase_24 AC 92 ms
71,804 KB
testcase_25 AC 90 ms
71,652 KB
testcase_26 AC 93 ms
71,848 KB
testcase_27 AC 93 ms
71,716 KB
testcase_28 AC 93 ms
71,680 KB
testcase_29 AC 92 ms
71,696 KB
testcase_30 AC 93 ms
71,724 KB
testcase_31 AC 94 ms
71,724 KB
testcase_32 AC 91 ms
71,548 KB
testcase_33 AC 93 ms
71,872 KB
testcase_34 AC 95 ms
71,464 KB
testcase_35 AC 94 ms
71,744 KB
testcase_36 AC 93 ms
71,440 KB
testcase_37 AC 93 ms
71,692 KB
testcase_38 AC 93 ms
71,436 KB
testcase_39 AC 93 ms
71,720 KB
testcase_40 AC 93 ms
71,580 KB
testcase_41 AC 93 ms
71,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
k = 2
while 2 ** (k - 2) <= N:
    tmp = 1
    q = deque([0] * (k - 1) + [1])
    sum0 = 1
    # print(q, sum0)
    while sum0 <= N:
        if sum0 == N:
            print(k)
            exit()
        q.append(sum0)
        sum0 += sum0
        sum0 -= q.popleft()
        # print(q,sum0)
    k += 1
print(-1)
0