結果

問題 No.314 ケンケンパ
ユーザー けむけむ
提出日時 2021-06-28 22:28:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,888 KB
最終ジャッジ日時 2024-06-25 17:13:35
合計ジャッジ時間 4,673 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

def K(N):
    if N == 1:
        return 1
    elif (N == 2) or (N == 3):
        return 2
    elif N == 4:
        return 3
    li = [1, 1]
    a, b, c = 1, 0, 1
    for i in range(N-3):
        a, b, c = b, c, a + b
        if i == N - 6:
            li[0] = c
        elif i == N - 5:
            li[1] = c
    result = (c + 2 * li[1] + li[0]) % (10 ** 9 + 7)
    return result

if __name__ == '__main__':
    N = int(input())
    print(K(N))
0