#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
ll const M = 1'000'000'007;
struct mod {
ll val;
// v >= 0
mod(ll const& v) {
if (v < M)
val = v;
else if (v < 2 * M)
val = v - M;
else
val = v % M;
}
mod operator +(mod const& rhs) const {
return val + rhs.val;
}
mod operator -(mod const& rhs) const {
return val + M - rhs.val;
}
mod operator *(mod const& rhs) const {
return val * rhs.val;
}
mod pow(ll const& p) const {
if (p == 0)
return 1;
if (p % 2 == 1)
return *this * pow(p - 1);
mod const hp = pow(p / 2);
return hp * hp;
}
mod inv() const {
return pow(M - 2);
}
mod operator /(mod const& rhs) const {
return *this * rhs.inv();
}
};
mod fact(ll const n) {
mod ans = 1;
for (ll i = 2; i <= n; i++)
ans = ans * i;
return ans;
}
mod nck(ll const n, ll const k) {
return fact(n) / fact(k) / fact(n - k);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll n;
cin >> n;
cout << ((nck(2 * n - 1, n - 1) - nck(2 * n - 1, n - 2)) / 2).val << "\n";
}
Részfeladat | Összpont | Teszt | Verdikt | Idő | Memória | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Elfogadva | 3ms | 2020 KiB | ||||
subtask2 | 10/10 | ||||||
2 | Elfogadva | 3ms | 2152 KiB | ||||
3 | Elfogadva | 3ms | 2388 KiB | ||||
4 | Elfogadva | 3ms | 2756 KiB | ||||
subtask3 | 40/40 | ||||||
5 | Elfogadva | 3ms | 2752 KiB | ||||
6 | Elfogadva | 3ms | 2916 KiB | ||||
7 | Elfogadva | 3ms | 2980 KiB | ||||
8 | Elfogadva | 3ms | 3212 KiB | ||||
9 | Elfogadva | 3ms | 3420 KiB | ||||
10 | Elfogadva | 3ms | 3544 KiB | ||||
11 | Elfogadva | 3ms | 3640 KiB | ||||
subtask4 | 50/50 | ||||||
12 | Elfogadva | 8ms | 3776 KiB | ||||
13 | Elfogadva | 30ms | 3880 KiB | ||||
14 | Elfogadva | 48ms | 3980 KiB | ||||
15 | Elfogadva | 16ms | 4096 KiB | ||||
16 | Elfogadva | 46ms | 4188 KiB | ||||
17 | Elfogadva | 26ms | 4272 KiB | ||||
18 | Elfogadva | 23ms | 4276 KiB | ||||
19 | Elfogadva | 52ms | 4188 KiB | ||||
20 | Elfogadva | 21ms | 4192 KiB | ||||
21 | Elfogadva | 57ms | 4424 KiB |