217342026-01-13 18:40:12algoproJáték (50 pont)cpp17Wrong answer 29/5059ms3544 KiB
// UUID: 5ff7947e-c9ed-447b-b816-b4d23f842005
#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;
}
SubtaskSumTestVerdictTimeMemory
base29/50
1Accepted0/01ms500 KiB
2Wrong answer0/02ms316 KiB
3Accepted2/21ms316 KiB
4Accepted3/31ms316 KiB
5Wrong answer0/31ms316 KiB
6Accepted3/31ms324 KiB
7Accepted3/32ms316 KiB
8Accepted3/32ms316 KiB
9Wrong answer0/32ms316 KiB
10Wrong answer0/32ms460 KiB
11Accepted3/34ms564 KiB
12Accepted3/38ms564 KiB
13Accepted3/313ms1044 KiB
14Wrong answer0/354ms3164 KiB
15Accepted3/327ms1588 KiB
16Wrong answer0/359ms3544 KiB
17Wrong answer0/339ms2100 KiB
18Wrong answer0/357ms3336 KiB
19Accepted3/354ms3124 KiB