Nu aveti permisiuni pentru a descarca fisierul grader_test2.ok
Cod sursa(job #636425)
| Utilizator | Data | 19 noiembrie 2011 20:00:45 | |
|---|---|---|---|
| Problema | Dirichlet | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | .com 2011 | Marime | 0.7 kb |
#include<stdio.h>
#include<assert.h>
#define ORLY 9999991
#define YARLY 9999989
int n;
long long sol2,sol,aux;
void read()
{
assert(freopen("dirichlet.in","r",stdin)!=NULL);
scanf("%d",&n);
}
void exp(long long x)
{
if(x==1)
return;
exp(x/2);
sol2=(sol2*sol2)%ORLY;
if(x%2==1)
sol2=(sol2*aux)%ORLY;
}
void solve()
{
int i,l=2*n;
sol=sol2=1;
for(i=n+2;i<=l;++i)
sol=(sol*i)%ORLY;
for(i=2;i<=n;++i)
sol2=(sol2*i)%ORLY;
aux=sol2;
exp(YARLY);
sol=(sol*sol2)%ORLY;
}
void write()
{
assert(freopen("dirichlet.out","w",stdout)!=NULL);
printf("%lld",sol);
}
int main()
{
read();
solve();
write();
return 0;
}
