打表找规律,发现1-n每个数的价值为等差数列,且第一个非零数为3-n的累乘
#include <bits/stdc++.h>
#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int mod = 998244353;
signed main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int n;
cin >> n;
int topval = 1;
int res = 0;
for (int i = 3; i <= n; i ++ ) topval = (topval * i % mod) % mod;
for (int i = 2, val = topval; i <= n; i ++) {
res = (res + val) % mod;
val = (val + topval) % mod;
}
cout << (res % mod + mod) % mod << endl;
return 0;
}