이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |