61642023-11-04 01:17:25horvathabelJáték (50 pont)cpp17Wrong answer 0/50179ms5084 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1000000007;

vector<int> fact(100001,0);
ll pw(ll a, ll b){
    ll ret=1;
    while (b>0){
        if (b%2==1){
            ret*=a;
            ret=ret%mod;
        }
        a*=a;
        a=a%mod;
        b/=2;
    }
    return ret;
}
ll choose(int n,int k){
    if (n==k) return 1;
    ll ret=fact[n];
    ret*=pw(fact[k],mod-2);
    ret%=mod;
    ret*=pw(fact[n-k],mod-2);
    ret=ret%mod;
    return ret;
}
int main()
{

    fact[1]=1;
    for (int i=2;i<=100001;i++){
        fact[i]=(fact[i-1]*i);
        fact[i]%=mod;
    }
    int b,c;
    cin>>b>>c;
    int ans=1;
    for (int i=1; i<=b;i++){
        ans+=choose(c-b+i,c-b);
        ans%=mod;
        ans-=choose(c-b+i-1,c-b);
        ans%=mod;
    }
    cout<<ans-1;

}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/04ms2516 KiB
2Wrong answer0/010ms2744 KiB
3Wrong answer0/24ms2960 KiB
4Wrong answer0/34ms3288 KiB
5Wrong answer0/36ms3560 KiB
6Wrong answer0/37ms3616 KiB
7Wrong answer0/38ms3596 KiB
8Wrong answer0/39ms3580 KiB
9Wrong answer0/38ms3808 KiB
10Wrong answer0/38ms3868 KiB
11Wrong answer0/317ms4092 KiB
12Wrong answer0/339ms4196 KiB
13Wrong answer0/363ms4412 KiB
14Wrong answer0/357ms4536 KiB
15Wrong answer0/363ms4828 KiB
16Time limit exceeded0/3165ms3724 KiB
17Wrong answer0/357ms4848 KiB
18Time limit exceeded0/3179ms3936 KiB
19Time limit exceeded0/3152ms5084 KiB