Pagini recente » Cod sursa (job #2365958) | Cod sursa (job #1631948) | Cod sursa (job #2305819) | Cod sursa (job #1059753) | Cod sursa (job #2151725)
#include <iostream>
#include <fstream>
#define MOD 9999991
using namespace std;
ifstream f("dirichlet.in");
ofstream g("dirichlet.out");
int fact[1000005];
int invers(long long x,long long y)
{
long long sol=1;
while(y)
{
if(y&1)sol=(1LL*sol*x)%MOD;
x=(1LL*x*x)%MOD;
y>>=1;
}
return sol;
}
void factorial()
{
int i; fact[1]=1;
for(i=2;i<=1000000;i++)fact[i]=(1LL*fact[i-1]*i)%MOD;
}
int comb(int n,int k)
{
if(!n||!k)return 1;
return (1LL*fact[n]*invers(1LL*fact[k]*fact[n-k]%MOD,MOD-2))%MOD;
}
int main()
{
int n;
f>>n;
factorial();
g<<(comb(2*n,n)*invers(n+1,MOD-2))%MOD;
return 0;
}