2025-03-18 08:37:39 +08:00

31 lines
342 B
C

#include <stdio.h>
//Ãݴη½
int power(int n){
int s = 1, i;
for(i=1;i<=n;i++){
s *= 2;
}
return s;
}
//½×³Ë
int factorial(int n){
int s = 1, i;
for(i=1;i<=n;i++){//1~n
s*=i;
}
return s;
}
int main(){
int n, i, s = 0;
scanf("%d", &n);
for(i=1;i<=n;i++){
s += power(i) * factorial(i);
}
printf("%d\n", s);
return 0;
}