Pagini recente » Cod sursa (job #2579655) | Cod sursa (job #438449) | Cod sursa (job #345504) | Cod sursa (job #341280) | Cod sursa (job #1090416)
/// (N + 2)(N + 3)...(N + N) / N!
#include <fstream>
#include <vector>
#include <bitset>
using namespace std;
const char infile[] = "dirichlet.in";
const char outfile[] = "dirichlet.out";
ifstream fin(infile);
ofstream fout(outfile);
const int MAXN = 4005;
const int oo = 0x3f3f3f3f;
const int MOD = 9999991;
typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;
const inline int min(const int &a, const int &b) { if( a > b ) return b; return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b; return a; }
const inline void Get_min(int &a, const int b) { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b) { if( a < b ) a = b; }
inline int lgPower(const int &A, const int &N) {
/// A ^ N
if(N == 1)
return A;
int aux = (1LL * A * A) % MOD;
if(N & 1)
return (1LL * A * lgPower(aux, (N - 1) / 2)) % MOD;
return lgPower(aux, N / 2);
}
inline int invMod(const int &value) {
return lgPower(value, MOD - 2);
}
int main() {
int N, factN = 1, factNplus = 1;
bool ok = false;
fin >> N;
for(int i = 1 ; i <= N ; ++ i) {
if(i == 2)
ok = true;
if(ok)
factNplus = (1LL * factNplus * (N + i)) % MOD;
factN = (1LL * factN * i) % MOD;
}
fout << (1LL * factNplus * invMod(factN)) % MOD << "\n";
fin.close();
fout.close();
return 0;
}