結果

問題 No.314 ケンケンパ
ユーザー one23one23
提出日時 2020-02-16 12:34:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 214 ms / 1,000 ms
コード長 195 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 171,488 KB
最終ジャッジ日時 2024-04-16 03:32:32
合計ジャッジ時間 2,904 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 211 ms
170,532 KB
testcase_01 AC 40 ms
53,976 KB
testcase_02 AC 39 ms
53,036 KB
testcase_03 AC 39 ms
52,496 KB
testcase_04 AC 40 ms
52,744 KB
testcase_05 AC 41 ms
51,816 KB
testcase_06 AC 40 ms
52,752 KB
testcase_07 AC 40 ms
52,356 KB
testcase_08 AC 40 ms
52,852 KB
testcase_09 AC 39 ms
52,624 KB
testcase_10 AC 40 ms
53,096 KB
testcase_11 AC 41 ms
53,864 KB
testcase_12 AC 41 ms
52,996 KB
testcase_13 AC 40 ms
52,816 KB
testcase_14 AC 46 ms
59,616 KB
testcase_15 AC 46 ms
60,260 KB
testcase_16 AC 47 ms
61,988 KB
testcase_17 AC 52 ms
69,140 KB
testcase_18 AC 132 ms
121,160 KB
testcase_19 AC 214 ms
171,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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