結果

問題 No.314 ケンケンパ
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-12 23:36:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 395 ms / 1,000 ms
コード長 212 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 10,544 KB
実行使用メモリ 47,060 KB
最終ジャッジ日時 2023-09-07 01:48:51
合計ジャッジ時間 9,407 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 395 ms
46,964 KB
testcase_01 AC 383 ms
46,960 KB
testcase_02 AC 381 ms
47,008 KB
testcase_03 AC 377 ms
47,056 KB
testcase_04 AC 377 ms
46,900 KB
testcase_05 AC 379 ms
47,032 KB
testcase_06 AC 381 ms
46,956 KB
testcase_07 AC 389 ms
47,060 KB
testcase_08 AC 386 ms
46,900 KB
testcase_09 AC 383 ms
46,964 KB
testcase_10 AC 381 ms
46,988 KB
testcase_11 AC 387 ms
46,900 KB
testcase_12 AC 387 ms
46,992 KB
testcase_13 AC 386 ms
46,972 KB
testcase_14 AC 378 ms
46,896 KB
testcase_15 AC 378 ms
46,960 KB
testcase_16 AC 386 ms
46,940 KB
testcase_17 AC 381 ms
46,948 KB
testcase_18 AC 382 ms
46,956 KB
testcase_19 AC 377 ms
46,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=1000000007
maxN=1000010
dp=[0]*maxN
dp[2]=1
dp[3]=1
dp[4]=1
for i in range(5,maxN):
    dp[i]=(dp[i-2]+dp[i-3])%mod
N=int(input())
if N==1 or N==2 :
    print(N)
else :
    print((dp[N]+dp[N-1]+dp[N-2])%mod)
0