AT_abc266_g求调,#6WA
查看原帖
AT_abc266_g求调,#6WA
607952
ZHANGGUIZHI楼主2024/10/17 10:44
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int P=998244353;
ll R,G,B,k,ans;
ll qs(ll a,ll b){
    ll ans=1;
    for(;b;b>>=1){
        if(b&1)ans=ans*a%P;
        a=a*a%P;
    }
    return ans;
}
ll C(ll n,ll m){
    if(m>(n>>1))m=n-m;
    if(m==0||m==n)return 1;
    ll res=1;
    for(ll i=n;i>=n-m+1;i--)
        res=res*i%P;
    for(ll i=m;i>=1;i--){
        ll Mod=qs(i,P-2);
        res=res*Mod%P;
    }
    return res;
}
signed main(){
    ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
    cin>>R>>G>>B>>k;
    cout<<C(B+G,B)*C(G,G-k)*C(B+R,R-k)%P;
    return 0;
}
2024/10/17 10:44
加载中...