Pagini recente » Cod sursa (job #3218220) | Cod sursa (job #364283) | Cod sursa (job #3181021) | Cod sursa (job #799215) | Cod sursa (job #1410603)
#include <iostream>
#include <fstream>
using namespace std;
#define base 100000000
unsigned long long nr[10000];
int l=1;
ifstream in("patrate2.in");
ofstream out("patrate2.out");
void mult (unsigned long long &x)
{
unsigned long long r=0;
int i;
for(i=1;i<=l;i++)
{
nr[i]*=x;
nr[i]+=r;
r=(nr[i]-nr[i]%base)/base;
nr[i]%=base;
}
if(r!=0)
{
l++;
nr[l]=r;
}
}
int main()
{
int exp,p;
int n;
unsigned long long x;
in>>n;
exp=n*n;
p=20;
x=1<<p;
nr[1]=1;
while( exp )
{
while(exp<p)
{
x>>=1;
p--;
}
mult(x);
exp-=p;
}
while(n>=3)
{
x=n*(n-1)*(n-2);
n-=3;
mult(x);
}
x=1;
//mult(6);
if(n==2)
//mult(2);
x=2,mult(x);
while(l)
{
out<<nr[l];
l--;
}
}