Cod sursa(job #1012154)
Utilizator | Andrei Mazareanu mazaandrei | Data | 18 octombrie 2013 12:46:51 |
---|---|---|---|
Problema | Dirichlet | Scor | 76 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<fstream>
#define M 9999991
using namespace std;
ifstream in("dirichlet.in");
ofstream out("dirichlet.out");
long long r=1,q,n,k;
inline long long inv(long long a, long long b){
int p=1;
while(b){
if(b&1) p=(p*a)%M; //(1LL*p*n)%MOD
a=(a*a)%M;
b/=2;
}
return p%M;
}
int main(){
in>>q;
n=2*q; k=q;
for(int i=1;i<k;++i)
r=((r*(n-i+1))%M * inv(i,M-2))%M;
r=((r%M)*inv(k,M-2)%M)%M;
out<<r<<'\n';
return 0;
}