結果

問題 No.554 recurrence formula
ユーザー URechaRechaURechaRecha
提出日時 2019-09-06 09:38:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 282 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 267,972 KB
最終ジャッジ日時 2023-09-05 19:43:09
合計ジャッジ時間 5,863 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,644 KB
testcase_01 AC 71 ms
71,428 KB
testcase_02 AC 72 ms
71,368 KB
testcase_03 AC 70 ms
71,348 KB
testcase_04 AC 74 ms
71,144 KB
testcase_05 AC 74 ms
71,136 KB
testcase_06 AC 72 ms
71,044 KB
testcase_07 AC 70 ms
71,204 KB
testcase_08 AC 72 ms
71,428 KB
testcase_09 AC 71 ms
71,140 KB
testcase_10 AC 72 ms
71,464 KB
testcase_11 AC 89 ms
76,160 KB
testcase_12 AC 84 ms
76,232 KB
testcase_13 AC 106 ms
76,036 KB
testcase_14 AC 90 ms
76,244 KB
testcase_15 AC 112 ms
76,160 KB
testcase_16 AC 116 ms
76,260 KB
testcase_17 AC 100 ms
76,076 KB
testcase_18 AC 95 ms
75,952 KB
testcase_19 TLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n= int(input())
    dp=[[2,2],[1,1]]
    for i in range(3,n+1,2):
        dp[1][0]=i *dp[0][1]
        dp[1][1]+=dp[1][0]
        dp[0][0]=(i+1) * dp[1][1]
        dp[0][1]+=dp[0][0]
    if n%2 == 0:print(dp[0][0]%(7+10**9))
    else:print(dp[1][0]%(7+10**9))
main()
0