結果

問題 No.314 ケンケンパ
ユーザー MarioMario
提出日時 2019-07-10 12:52:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 274 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 141,824 KB
最終ジャッジ日時 2024-04-23 01:33:53
合計ジャッジ時間 4,648 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 32 ms
10,752 KB
testcase_11 AC 30 ms
10,880 KB
testcase_12 AC 32 ms
10,752 KB
testcase_13 AC 31 ms
10,880 KB
testcase_14 AC 39 ms
11,520 KB
testcase_15 AC 43 ms
12,032 KB
testcase_16 AC 65 ms
14,208 KB
testcase_17 AC 175 ms
24,192 KB
testcase_18 AC 837 ms
74,624 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

def mod(i):
	return i % (10**9 + 7)

dp = [[0 for _ in range(3)] for _ in range(n)]
dp[0][0] = 0
dp[0][1] = 1
dp[0][2] = 0

for i in range(n-1):
	dp[i+1][0] = mod(dp[i][1] + dp[i][2])
	dp[i+1][1] = dp[i][0]
	dp[i+1][2] = dp[i][1]
	
print(mod(sum(dp[-1])))
0