結果

問題 No.314 ケンケンパ
ユーザー nohakai3nohakai3
提出日時 2022-10-17 20:23:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 1,000 ms
コード長 268 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 83,404 KB
最終ジャッジ日時 2023-09-10 18:52:21
合計ジャッジ時間 2,875 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
83,272 KB
testcase_01 AC 73 ms
71,356 KB
testcase_02 AC 72 ms
71,420 KB
testcase_03 AC 81 ms
71,360 KB
testcase_04 AC 73 ms
71,224 KB
testcase_05 AC 74 ms
71,392 KB
testcase_06 AC 72 ms
71,072 KB
testcase_07 AC 71 ms
71,580 KB
testcase_08 AC 72 ms
71,152 KB
testcase_09 AC 73 ms
71,344 KB
testcase_10 AC 72 ms
71,356 KB
testcase_11 AC 72 ms
71,408 KB
testcase_12 AC 73 ms
71,324 KB
testcase_13 AC 71 ms
71,324 KB
testcase_14 AC 74 ms
75,584 KB
testcase_15 AC 76 ms
75,732 KB
testcase_16 AC 77 ms
75,840 KB
testcase_17 AC 78 ms
76,436 KB
testcase_18 AC 82 ms
79,732 KB
testcase_19 AC 84 ms
83,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
dp=[0]*(n+1)
if n==4:
    exit(print(3))
elif n==3:
    exit(print(2))
elif n==2:
    print(2)
    exit()
elif n==1:
    exit(print(1))
dp[1]=1
dp[2]=2
dp[3]=2
dp[4]=3


for i in range(5,n+1):
    dp[i]=(dp[i-2]+dp[i-3])%(10**9+7)
print(dp[n]%(10**9+7))
0