HDU6397(容斥)

#include
#include
#include
#include
#include
using namespace std;
#define maxn 200005
typedef long long ll;

ll mod = 998244353;
ll f[maxn], fv[maxn]; //f阶乘,fv乘法逆元
ll qpow(ll a, ll b)
{
    ll ans = 1;
    for(; b; b>>=1)
    {
        if(b&1) ans = ans*a%mod;
        a = a*a%mod;
    }
    return ans;
}

void init()
{
    f[0] = 1;
    for(ll i = 1; i <= maxn; i++)
        f[i] = (f[i-1]*i)%mod;
    fv[maxn-1] = qpow(f[maxn-1], mod-2);
    for(ll i = maxn-1; i > 0; i--)
    {
        fv[i-1] = fv[i]*i%mod;
    }
}

ll C(ll n, ll m)
{
    if(n<0||m<0||n

 

你可能感兴趣的:(组合数学)