結果

問題 No.554 recurrence formula
ユーザー nannanynannany
提出日時 2017-08-12 00:04:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 369 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 817,536 KB
最終ジャッジ日時 2024-04-21 00:04:24
合計ジャッジ時間 3,003 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 MLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == '__main__':
    N = int(input())
    memo = [-1 for i in range(N + 1)]
    memo[1] = 1

    sum_odd = 1
    sum_even = 0
    for i in range(2, N + 1):
        if i % 2 == 0:
            memo[i] = sum_odd * i
            sum_even += memo[i]
        else:
            memo[i] = sum_even * i
            sum_odd += memo[i]

    print(memo[N] // 1000000007)
0