結果

問題 No.554 recurrence formula
ユーザー URechaRechaURechaRecha
提出日時 2019-09-06 09:31:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 304 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 8,416 KB
最終ジャッジ日時 2023-09-05 19:32:41
合計ジャッジ時間 4,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,820 KB
testcase_01 AC 17 ms
7,692 KB
testcase_02 AC 16 ms
7,692 KB
testcase_03 AC 16 ms
7,772 KB
testcase_04 AC 16 ms
7,860 KB
testcase_05 AC 16 ms
7,764 KB
testcase_06 AC 16 ms
7,740 KB
testcase_07 AC 16 ms
7,776 KB
testcase_08 AC 16 ms
7,852 KB
testcase_09 AC 15 ms
7,760 KB
testcase_10 AC 17 ms
7,924 KB
testcase_11 AC 26 ms
8,336 KB
testcase_12 AC 23 ms
8,228 KB
testcase_13 AC 47 ms
8,188 KB
testcase_14 AC 25 ms
8,196 KB
testcase_15 AC 52 ms
8,280 KB
testcase_16 AC 59 ms
8,416 KB
testcase_17 AC 37 ms
8,332 KB
testcase_18 AC 33 ms
8,220 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:
        num = dp[0][0]
    else:
        num = dp[1][0]
    print(num%(10**9+7))
main()
0