結果

問題 No.554 recurrence formula
ユーザー Akijin_007Akijin_007
提出日時 2023-10-05 10:43:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 225 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 87,336 KB
実行使用メモリ 80,212 KB
最終ジャッジ日時 2023-10-05 10:43:26
合計ジャッジ時間 3,621 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 75 ms
71,388 KB
testcase_02 AC 70 ms
71,192 KB
testcase_03 AC 68 ms
71,200 KB
testcase_04 AC 70 ms
71,336 KB
testcase_05 AC 69 ms
71,580 KB
testcase_06 AC 71 ms
71,452 KB
testcase_07 AC 78 ms
71,456 KB
testcase_08 AC 72 ms
71,336 KB
testcase_09 AC 69 ms
71,376 KB
testcase_10 AC 75 ms
76,036 KB
testcase_11 AC 76 ms
76,008 KB
testcase_12 AC 73 ms
75,744 KB
testcase_13 AC 73 ms
76,048 KB
testcase_14 AC 73 ms
76,116 KB
testcase_15 AC 75 ms
76,004 KB
testcase_16 AC 75 ms
76,012 KB
testcase_17 AC 75 ms
76,032 KB
testcase_18 AC 75 ms
76,112 KB
testcase_19 AC 75 ms
75,960 KB
testcase_20 AC 75 ms
75,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10 ** 9 + 7

odd = 1
even = 0

for i in range(2, N+1):
    if i % 2 == 0:
        a = i * odd
        even = (even + a) % mod
    else:
        a = i * even
        odd = (odd + a) % mod

print(a % mod)
0