This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int mx=1e6+5;
typedef long long ll;
ll fact[mx];
ll exp(ll a, ll b, ll m) {
ll r=1;
while(b) {
if(b%2) r=(r*a)%m;
a=(a*a)%m;
b/=2;
}
return r;
}
ll inv(ll a, ll m) {
return exp(a,m-2,m);
}
int binom(int n, int m, int mod) {
ll a=fact[n], b=fact[m], c=fact[n-m];
ll ret=a*inv(b,mod);
ret%=mod;
ret*=inv(c,mod);
ret%=mod;
return ret;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
fact[0]=1;
for (int i=1; i<mx; i++)
fact[i]=(fact[i-1]*i)%mod;
int n,k; cin>>n>>k;
cout << binom(n,n/2,mod) << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |