Cod sursa(job #2384063)
Utilizator | Sebi nechita sebi212 | Data | 20 martie 2019 10:29:44 |
---|---|---|---|
Problema | Dirichlet | Scor | 24 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<cstdio>
using namespace std;
#define MOD 9999991
long long fast_pow(int a,int b)
{
long long aa=a,p;
for(p=1;b; b=b>>1)
{
if(b&1)
p=(p*aa)%MOD;
aa=(aa*aa)%MOD;
}
return p;
}
int main()
{
freopen("dirichlet.in","r",stdin);
freopen("dirichlet.out","w",stdout);
int n,a,b,i;
scanf("%d",&n);
a=b=1;
for(i=2;i<=n;i++)
{
a=a*(n+i)%MOD;
b=b*i%MOD;
}
int af=a*(fast_pow(b,MOD-2))%MOD;
printf("%d",af);
return 0;
}