求大佬调!
查看原帖
求大佬调!
285414
Swiftie_wyc22楼主2022/10/19 06:00


#include <bits/stdc++.h>
#define rei register int
#define LL long long
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define cvar int n, m, T;
#define rep(i, s, n, c) for (register int i = s; i <= n; i+=c)
#define repd(i, s, n, c) for (register int i = s; i >= n; i-=c)
#define CHECK cout<<"WALKED"<<endl;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0' && ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();return x*f;}
#define pb push_back
#define ls id<<1
#define rs id<<1|1
const int INF = INT_MAX;
long long binpow(long long a, long long b, LL mod){long long res = 1;  while (b > 0){if (b & 1) res = res * a % mod;a = a * a % mod;  b >>= 1;  }  return res;}
using namespace std;
const LL maxn = 100010;
const LL mod = 998244353;
LL fac[maxn];
inline LL C(int n, int m)
{
	return fac[n] * binpow(fac[n - m], mod - 2, mod) % mod * binpow(fac[m], mod - 2, mod) % mod;
}
int main()
{
	fac[0] = 1;
	rep (i, 1, maxn - 1, 1)
		fac[i] = 1ll * fac[i - 1] * i % mod;
	
	int n = read();
	LL ans = 2;
	rep (S_size, 2, n - 2, 1)
	{
		ans = (ans + C(n - 2, S_size - 1)) % mod;
	}
	if (n % 2 == 0)
	{
		ans = ans - C(n - 2, n / 2 - 1);
	}
	cout << (ans % mod + mod) % mod << endl;
	return 0;
}
2022/10/19 06:00
加载中...