Algorithm/lanqiao/series13sheng/tg_wa.py

24 lines
419 B
Python

import io
import sys
sys.stdin = io.StringIO('3') # 9
sys.stdin = io.StringIO('2022') # 593300958
# from itertools import permutations
#
# per = list(permutations(range(5)))
# print(per)
# 冒泡的交换次数公式
# print(len(per))
n = int(input())
ans = 0
per_num = 1
for i in range(1, n + 1):
for p in range(2, i + 1):
per_num *= p
ans += per_num // 2
ans %= 998244353
print(ans)