240542026-02-03 18:35:35abcdJáték (50 pont)cpp17Wrong answer 3/503ms1588 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

const ll M=1e9+7;

ll inv(ll n){
    ll res=1,mm=M-2;
    while(mm){
        if(mm&1)res=res*n%M;
        n=n*n%M;
        mm>>=1;
    }
    return res;
}

int main(){
    ll b,c;cin>>b>>c;
    vector<ll> fact(2*c-b);
    fact[0]=1;
    for(ll i=1;i<2*c-b;i++)fact[i]=fact[i-1]*i%M;
    cout<<(fact[2*c-b-1]*inv(fact[c-1])%M*inv(fact[c-b])%M-fact[2*c-b-1]*inv(fact[c])%M*inv(fact[c-b-1])+M)%M<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base3/50
1Accepted0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/21ms316 KiB
4Accepted3/31ms316 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms560 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/31ms316 KiB
11Wrong answer0/31ms332 KiB
12Wrong answer0/32ms548 KiB
13Wrong answer0/32ms588 KiB
14Wrong answer0/33ms1588 KiB
15Wrong answer0/32ms820 KiB
16Wrong answer0/33ms1332 KiB
17Wrong answer0/32ms1076 KiB
18Wrong answer0/33ms1076 KiB
19Wrong answer0/32ms1332 KiB