結果

問題 No.314 ケンケンパ
ユーザー shobonvipshobonvip
提出日時 2020-05-10 18:53:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 426 ms / 1,000 ms
コード長 228 bytes
コンパイル時間 956 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 47,336 KB
最終ジャッジ日時 2023-09-22 08:54:08
合計ジャッジ時間 3,047 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 426 ms
46,676 KB
testcase_01 AC 17 ms
7,752 KB
testcase_02 AC 17 ms
7,852 KB
testcase_03 AC 16 ms
7,952 KB
testcase_04 AC 16 ms
7,952 KB
testcase_05 AC 16 ms
7,784 KB
testcase_06 AC 16 ms
7,808 KB
testcase_07 AC 16 ms
7,952 KB
testcase_08 AC 17 ms
7,796 KB
testcase_09 AC 17 ms
7,812 KB
testcase_10 AC 16 ms
7,872 KB
testcase_11 AC 16 ms
7,916 KB
testcase_12 AC 16 ms
7,844 KB
testcase_13 AC 16 ms
7,868 KB
testcase_14 AC 19 ms
8,300 KB
testcase_15 AC 20 ms
8,180 KB
testcase_16 AC 26 ms
9,044 KB
testcase_17 AC 57 ms
11,984 KB
testcase_18 AC 212 ms
26,880 KB
testcase_19 AC 415 ms
47,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [0 for _ in range(n+1)]

if n>=5:
	a[0] = 1
	a[1] = 1
	a[2] = 2
	a[3] = 2
	a[4] = 3
	mod = 10 ** 9 + 7
	for i in range(5, n+1):
		a[i] = (a[i-3] + a[i-2])%mod
	print(a[n])
else:
	a = [1,1,2,2,3]
	print(a[n])
0