답안 #19762

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19762 2016-02-25T05:22:09 Z yongwhan 괄호 (kriii4_R) C++14
8 / 100
9 ms 9524 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 9524 KB Output is correct
2 Correct 9 ms 9524 KB Output is correct
3 Correct 3 ms 9524 KB Output is correct
4 Correct 9 ms 9524 KB Output is correct
5 Correct 9 ms 9524 KB Output is correct
6 Correct 9 ms 9524 KB Output is correct
7 Correct 9 ms 9524 KB Output is correct
8 Correct 9 ms 9524 KB Output is correct
9 Correct 9 ms 9524 KB Output is correct
10 Correct 9 ms 9524 KB Output is correct
11 Correct 9 ms 9524 KB Output is correct
12 Correct 9 ms 9524 KB Output is correct
13 Correct 4 ms 9524 KB Output is correct
14 Correct 9 ms 9524 KB Output is correct
15 Correct 6 ms 9524 KB Output is correct
16 Correct 9 ms 9524 KB Output is correct
17 Correct 9 ms 9524 KB Output is correct
18 Correct 6 ms 9524 KB Output is correct
19 Correct 9 ms 9524 KB Output is correct
20 Correct 6 ms 9524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 9524 KB Output isn't correct
2 Halted 0 ms 0 KB -