結果

問題 No.314 ケンケンパ
ユーザー aqua_tenhouaqua_tenhou
提出日時 2020-09-15 22:31:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 270 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,520 KB
実行使用メモリ 204,216 KB
最終ジャッジ日時 2023-09-04 03:01:11
合計ジャッジ時間 7,262 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 15 ms
7,908 KB
testcase_03 AC 15 ms
7,784 KB
testcase_04 AC 15 ms
7,780 KB
testcase_05 AC 15 ms
7,816 KB
testcase_06 AC 15 ms
7,836 KB
testcase_07 AC 15 ms
7,756 KB
testcase_08 AC 15 ms
7,800 KB
testcase_09 AC 15 ms
7,776 KB
testcase_10 AC 15 ms
7,788 KB
testcase_11 AC 15 ms
7,796 KB
testcase_12 AC 15 ms
7,708 KB
testcase_13 AC 16 ms
8,216 KB
testcase_14 AC 22 ms
9,136 KB
testcase_15 AC 29 ms
10,120 KB
testcase_16 AC 50 ms
13,032 KB
testcase_17 AC 163 ms
27,580 KB
testcase_18 AC 770 ms
101,824 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 10**9 + 7
d = [[0,0,0] for i in range(n)]
d[0][0] = 1
for i in range(1,n):
    d[i][0] = d[i-1][2]
    d[i][1] = d[i-1][0]
    d[i][2] = d[i-1][0] + d[i-1][1]
    
    d[i][0] %= mod
    d[i][1] %= mod
    d[i][2] %= mod
    
print(sum(d[-1])%mod)
0