// formula used n!+2^n-n
#include<stdio.h>
#include<math.h>
int main()
{
/*unsigned long long int factorial[]={ 1, 1 , 2 , 6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000, 6402373705728000};*/
unsigned long long int t,ans,fect,pow,p,n;
scanf("%llu",&t);
fect=1;
p=t;
n=t;
while(t>0)
{
fect=fect*t;
t--;
}
//printf("%llu ",fect);
pow=1;
while(p>0)
{
pow=pow*2;
p--;
}
//printf("%llu ",pow);
ans=fect+pow-n;
printf("%llu\n",ans);
return 0;
}
No comments:
Post a Comment