Pagini recente » Cod sursa (job #1906869) | Cod sursa (job #2986841) | Cod sursa (job #150532) | Cod sursa (job #2904955) | Cod sursa (job #1794843)
#include <fstream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
ifstream fin("dirichlet.in");
ofstream fout("dirichlet.out");
const int mod = 9999991;
void Euclid(int a, int b, int& x, int& y) {
if (!b) {
x=1, y=0;
return;
}
int xa, ya;
Euclid(b, a%b, xa, ya);
x = ya;
y = xa - (a/b)*ya;
}
int InvMod(int val) {
int x, y;
Euclid(mod, val, x, y);
y %= mod;
if (y < 0) y += mod;
return y;
}
int main() {
int n; fin >> n;
int fact1=1, fact2=1;
for (int i = 1; i <= n + n; ++i) {
fact2 = (1LL*fact2*i) % mod;
if (i == n)
fact1 = fact2;
}
int sol = 1;
sol = (1LL * sol * InvMod(n + 1)) % mod;
sol = (1LL * sol * fact2) % mod;
int temp = InvMod(fact1);
sol = (1LL * sol * temp) % mod;
sol = (1LL * sol * temp) % mod;
fout << sol << '\n';
return 0;
}
//Trust me, I'm the Doctor!