結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,228 KB
testcase_01 AC 16 ms
7,904 KB
testcase_02 AC 17 ms
7,756 KB
testcase_03 AC 17 ms
7,848 KB
testcase_04 AC 16 ms
7,804 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 16 ms
7,764 KB
testcase_07 AC 15 ms
7,924 KB
testcase_08 AC 16 ms
7,756 KB
testcase_09 AC 16 ms
7,688 KB
testcase_10 AC 17 ms
7,784 KB
testcase_11 AC 26 ms
8,372 KB
testcase_12 AC 23 ms
8,240 KB
testcase_13 AC 46 ms
8,108 KB
testcase_14 AC 26 ms
8,272 KB
testcase_15 AC 53 ms
8,336 KB
testcase_16 AC 61 ms
8,320 KB
testcase_17 AC 37 ms
8,180 KB
testcase_18 AC 33 ms
8,216 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