217492026-01-13 19:04:06algoproJáték (50 pont)cpp17Wrong answer 29/5059ms3424 KiB
// UUID: 1f91bdaf-1f72-495c-9483-55ed388b8b8b
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll M=1e9+7;

ll binpow(ll a, ll b) {
    if (b==0)return 1LL;
    ll c=binpow(a, b/2);
    if (b%2==1)return (((c*c)%M)*a)%M;
    else return (c*c)%M;
}

int main() {
	ll b, c;cin>>b>>c;
    vector<ll>fact(2*c+2,1),inv(2*c+2,1);
    for(int i=1;i<=2*c+1;i++){
        fact[i]=fact[i-1]*i;fact[i]%=M;
        inv[i]=binpow(fact[i],M-2);
    }
    cout<<((((fact[2*c-b-1]*inv[c-1])%M)*inv[c-b])%M-(((fact[2*c-b-1]*inv[c])%M)*inv[c-b-1]+M)%M)%M;
}
SubtaskSumTestVerdictTimeMemory
base29/50
1Accepted0/01ms316 KiB
2Wrong answer0/02ms316 KiB
3Accepted2/21ms316 KiB
4Accepted3/31ms508 KiB
5Wrong answer0/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/32ms316 KiB
8Accepted3/32ms508 KiB
9Wrong answer0/32ms316 KiB
10Wrong answer0/32ms508 KiB
11Accepted3/34ms568 KiB
12Accepted3/38ms804 KiB
13Accepted3/313ms1048 KiB
14Wrong answer0/354ms3156 KiB
15Accepted3/327ms1588 KiB
16Wrong answer0/359ms3424 KiB
17Wrong answer0/339ms2100 KiB
18Wrong answer0/357ms3124 KiB
19Accepted3/354ms3140 KiB