結果

問題 No.314 ケンケンパ
ユーザー 双六双六
提出日時 2019-04-06 00:39:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 275 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 159,744 KB
最終ジャッジ日時 2024-06-23 03:36:29
合計ジャッジ時間 6,181 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,624 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 29 ms
10,752 KB
testcase_09 AC 29 ms
10,880 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 30 ms
10,624 KB
testcase_12 AC 30 ms
10,624 KB
testcase_13 AC 30 ms
10,880 KB
testcase_14 AC 36 ms
11,648 KB
testcase_15 AC 39 ms
12,160 KB
testcase_16 AC 56 ms
14,464 KB
testcase_17 AC 132 ms
25,728 KB
testcase_18 AC 612 ms
81,920 KB
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

if N == 1:
	print(1)
else:
	KP = [[0, 0] for i in range(N)]
	KP[0][0] = 1
	KP[1][0] = 1
	KP[1][1] = 1
	for i in range(2, N):
		KP[i][0] = (KP[i - 2][1] + KP[i - 1][1]) % 1000000007
		KP[i][1] = KP[i - 1][0] % 1000000007

	print(sum(KP[N - 1]) % 1000000007)
0