Pagini recente » Cod sursa (job #1814281) | Cod sursa (job #2270457) | Cod sursa (job #2511443) | Cod sursa (job #1140172) | Cod sursa (job #638490)
Cod sursa(job #638490)
#include <fstream>
using namespace std;
const int MOD = 9999991;
int N, fact[2000002];
inline int power(int x, int y)
{
if (y == 0) return 1;
if (y % 2 == 0) return power(1LL * x * x % MOD, y >> 1);
return (1LL * x * power(1LL * x * x % MOD, y >> 1)) % MOD;
}
inline int inv(int x)
{
return power(x, MOD - 2);
}
inline int comb(int x, int y)
{
return 1LL * (1LL * fact[x] * inv(fact[x - y]) % MOD) * inv(fact[y]) % MOD;
}
int main()
{
ifstream fin("dirichlet.in");
ofstream fout("dirichlet.out");
fact[0] = 1;
for (int i = 1; i <= 2000000; ++i)
fact[i] = 1LL * fact[i - 1] * i % MOD;
fin >> N;
int result = comb(2 * N, N) - comb(2 * N, N + 1);
if (result < 0) result += MOD;
fout << result;
fin.close();
fout.close();
}