Pagini recente » Cod sursa (job #1960651) | Cod sursa (job #2604172) | Cod sursa (job #3121992)
//Ilie Dumitru
#include<cstdio>
const int NMAX=4005;
const long long int BASE=1000000000;
struct big
{
int N;
long long int v[NMAX];
big() : N(1)
{
int i;
for(i=0;i<NMAX;++i)
this->v[i]=0;
}
big(long long int x)
{
int i;
for(i=0;i<NMAX && x;++i)
this->v[i]=x%BASE, x/=BASE;
this->N=i;
for(;i<NMAX;++i)
this->v[i]=0;
}
big& operator*=(long long int x)
{
int i;
long long int t;
for(i=t=0;i<this->N || t;++i)
{
this->v[i]=this->v[i]*x+t;
t=this->v[i]/BASE;
this->v[i]%=BASE;
}
this->N=i;
return *this;
}
void print(FILE* out)
{
int i, j, p;
char s[NMAX];
sprintf(s, "%d", (int)this->v[this->N-1]);
for(j=0;s[j];++j);
for(i=this->N-2;i>-1;--i)
for(p=BASE/10;p>0;p/=10)
s[j++]=this->v[i]/p%10;
fprintf(out, s);
}
};
int main()
{
FILE* f=fopen("patrate2.in", "r"), *g=fopen("patrate2.out", "w");
//FILE* f=stdin, *g=stdout;
int N, i, aux;
big ans(1);
fscanf(f, "%d", &N);
for(i=1;i<=N;i+=4)
{
if(i+2<N)
aux=i*(i+1)*(i+2)*(i+3);
else
{
aux=i++;
while(i<=N)
aux*=i++;
}
ans*=aux;
}
for(i=30;i<=N*N;i+=30)
ans*=1<<30;
ans*=1<<(30-(i-N*N));
ans.print(g);
fclose(f);
fclose(g);
return 0;
}