結果

問題 No.314 ケンケンパ
ユーザー 双六双六
提出日時 2019-04-06 00:39:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 275 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 157,112 KB
最終ジャッジ日時 2023-09-05 07:22:34
合計ジャッジ時間 5,927 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 15 ms
7,868 KB
testcase_02 AC 15 ms
7,768 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 AC 15 ms
7,812 KB
testcase_05 AC 16 ms
7,948 KB
testcase_06 AC 15 ms
7,768 KB
testcase_07 AC 16 ms
7,812 KB
testcase_08 AC 16 ms
7,908 KB
testcase_09 AC 16 ms
7,776 KB
testcase_10 AC 16 ms
7,816 KB
testcase_11 AC 16 ms
7,764 KB
testcase_12 AC 16 ms
7,816 KB
testcase_13 AC 16 ms
8,156 KB
testcase_14 AC 21 ms
8,912 KB
testcase_15 AC 25 ms
9,712 KB
testcase_16 AC 39 ms
11,828 KB
testcase_17 AC 112 ms
23,076 KB
testcase_18 AC 549 ms
79,400 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