結果
問題 | No.314 ケンケンパ |
ユーザー | fmhr |
提出日時 | 2015-12-07 10:02:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 102 ms / 1,000 ms |
コード長 | 580 bytes |
コンパイル時間 | 399 ms |
コンパイル使用メモリ | 86,932 KB |
実行使用メモリ | 91,500 KB |
最終ジャッジ日時 | 2023-10-12 19:53:21 |
合計ジャッジ時間 | 2,907 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 98 ms
91,424 KB |
testcase_01 | AC | 75 ms
71,316 KB |
testcase_02 | AC | 75 ms
71,300 KB |
testcase_03 | AC | 79 ms
71,024 KB |
testcase_04 | AC | 74 ms
71,316 KB |
testcase_05 | AC | 73 ms
71,360 KB |
testcase_06 | AC | 75 ms
71,172 KB |
testcase_07 | AC | 75 ms
71,392 KB |
testcase_08 | AC | 75 ms
71,508 KB |
testcase_09 | AC | 73 ms
71,596 KB |
testcase_10 | AC | 75 ms
71,476 KB |
testcase_11 | AC | 76 ms
71,516 KB |
testcase_12 | AC | 75 ms
71,204 KB |
testcase_13 | AC | 77 ms
71,424 KB |
testcase_14 | AC | 82 ms
76,036 KB |
testcase_15 | AC | 81 ms
76,160 KB |
testcase_16 | AC | 80 ms
76,512 KB |
testcase_17 | AC | 84 ms
77,812 KB |
testcase_18 | AC | 93 ms
83,552 KB |
testcase_19 | AC | 102 ms
91,500 KB |
ソースコード
# coding:utf-8 p = 1000000000+7 N = int(input()) dp = [0] * (N+10) dp[0] = 1 dp[1] = 2 dp[2] = 2 pa_point = [0]*(N+10) pa_point[1] = 1 pa_point[2] = 1 pa_point[3] = 1 pa_point[4] = 2 pa_point[5] = 1 for i in range(3,N+1): # print(i,dp[i-1],pa_point[i-2],'ans:',dp[i-1]+pa_point[i-2]%p) # print(i,pa_point) dp[i] = (dp[i-1]+pa_point[i-2])%p if pa_point[i]>0 and i >2: pa_point[i+2] = (pa_point[i+2]+pa_point[i])%p pa_point[i+3] = (pa_point[i+3]+pa_point[i])%p # print(pa_point) # print(dpoint) # print(dp) # print(pa_point) print(dp[N-1]%p)