제출 #19762

#제출 시각아이디문제언어결과실행 시간메모리
19762yongwhan괄호 (kriii4_R)C++14
8 / 100
9 ms9524 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...