#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
const int MOD = 1e9 + 7;
const int MN = 1e6 + 10;
int fpow(int n, int k)
{
if(k == 0) return 1;
if(k % 2){
return 1ll * n * fpow(n, k - 1) % MOD;
}
int h = fpow(n, k / 2);
return 1ll * h * h % MOD;
}
inline int inv(int n)
{
return 1ll * fpow(n, MOD - 2) % MOD;
}
inline void mult(int& a, int b)
{
a = 1ll * a * b % MOD;
}
inline int mult2(int a, int b)
{
return 1ll * a * b % MOD;
}
inline void sub(int& a, int b)
{
a = ((a - b) % MOD + MOD) % MOD;
}
inline int rational(int a, int b)
{
return 1ll * a * inv(b) % MOD;
}
inline void add(int &a, int b)
{
a = ((a + b) % MOD + MOD) % MOD;
}
inline int add2(int a, int b)
{
return ((a + b) % MOD + MOD) % MOD;
}
int nCr(int n, int r)
{
int ans = 1;
for(int i = 1; i <= r; ++i){
mult(ans, inv(i));
mult(ans, n - i + 1);
}
return ans;
}
int main()
{
int n, k;
cin >> n >> k;
if(n == 1){
cout << 1 << '\n';
return 0;
}
cout << nCr(n, n/2) << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
66 ms |
1720 KB |
Output is correct |
2 |
Correct |
13 ms |
1720 KB |
Output is correct |
3 |
Correct |
159 ms |
1720 KB |
Output is correct |
4 |
Correct |
178 ms |
1720 KB |
Output is correct |
5 |
Correct |
181 ms |
1720 KB |
Output is correct |
6 |
Correct |
100 ms |
1720 KB |
Output is correct |
7 |
Correct |
112 ms |
1720 KB |
Output is correct |
8 |
Correct |
75 ms |
1720 KB |
Output is correct |
9 |
Correct |
31 ms |
1720 KB |
Output is correct |
10 |
Correct |
8 ms |
1720 KB |
Output is correct |
11 |
Correct |
5 ms |
1720 KB |
Output is correct |
12 |
Correct |
163 ms |
1720 KB |
Output is correct |
13 |
Correct |
153 ms |
1720 KB |
Output is correct |
14 |
Correct |
67 ms |
1720 KB |
Output is correct |
15 |
Correct |
71 ms |
1720 KB |
Output is correct |
16 |
Correct |
65 ms |
1720 KB |
Output is correct |
17 |
Correct |
194 ms |
1720 KB |
Output is correct |
18 |
Correct |
203 ms |
1720 KB |
Output is correct |
19 |
Correct |
216 ms |
1720 KB |
Output is correct |
20 |
Correct |
215 ms |
1720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
59 ms |
1720 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |