結果

問題 No.554 recurrence formula
ユーザー Akijin_007Akijin_007
提出日時 2023-10-05 10:44:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 76,200 KB
最終ジャッジ日時 2023-10-05 10:44:05
合計ジャッジ時間 3,337 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,484 KB
testcase_01 AC 75 ms
71,200 KB
testcase_02 AC 76 ms
71,188 KB
testcase_03 AC 74 ms
71,680 KB
testcase_04 AC 75 ms
71,196 KB
testcase_05 AC 76 ms
71,580 KB
testcase_06 AC 75 ms
71,404 KB
testcase_07 AC 89 ms
71,520 KB
testcase_08 AC 77 ms
71,620 KB
testcase_09 AC 75 ms
71,648 KB
testcase_10 AC 79 ms
76,008 KB
testcase_11 AC 80 ms
76,000 KB
testcase_12 AC 77 ms
76,132 KB
testcase_13 AC 78 ms
75,972 KB
testcase_14 AC 81 ms
76,200 KB
testcase_15 AC 78 ms
75,868 KB
testcase_16 AC 80 ms
75,988 KB
testcase_17 AC 80 ms
75,960 KB
testcase_18 AC 96 ms
76,052 KB
testcase_19 AC 79 ms
76,008 KB
testcase_20 AC 78 ms
75,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

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

odd = 1
even = 0
a = 1

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