这是什么愚蠢的问题啊QAQAQ第一次求组合数出错啊
请看主函数
#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))
template<typename T> T min(T x, T y)
{
return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
return x > y ? x : y;
};
const long long P = 998244353;
const long long MAXN = 500005;
long long qpow(long long x, long long y)
{
if(!y)
return 1;
long long t = qpow(x, y / 2);
t = t*t % P;
if(y & 1)
t = t*x % P;
return t;
}
long long N, len = 1;
long long fac[MAXN];
long long C(long long n, long long k)
{
if(k > n)
return 0;
return fac[n] * qpow(fac[k], P - 2) % P * qpow(fac[n - k], P - 2) % P;
}
void init()
{
N = 100005;
fac[0] = 1;
for(long long i = 1; i <= N; i++)
fac[i] = fac[i - 1] * i % P;
}
int main()
{
init();
long long i = 44683;
if(C(i, 2) != i * (i - 1) / 2)
{
printf("%lld %lld %lld\n", i, C(i, 2), i * (i - 1) / 2);
printf("%lld %lld %lld\n", fac[i], fac[2], fac[i] * qpow(fac[i - 2], P - 2) % P * qpow(fac[2], P - 2) % P);
system("pause");
}
return 0;
}