#include<bits/stdc++.h>
using namespace std;
const int MAXN=110;
struct gj{
int n;
int a[MAXN];
gj(){
n=1;
memset(a,0,sizeof(a));
}
void fuzhi(int x){
int k=0;
while(x>0){
a[++k]=x%10;
x/=10;
}
}
void shch(){
for(int i=n;i>=1;--i){
cout<<a[i];
}
cout<<'\n'/*' '*/;
}
}ans;
gj operator+(const gj &a,const gj &b){
gj c;
c.n=max(a.n,b.n)+1;
for(int i=1;i<=c.n;++i){
c.a[i]+=a.a[i]+b.a[i];
}
for(int i=1;i<=c.n;++i){
c.a[i+1]+=c.a[i]/10;
c.a[i]=c.a[i]%10;
}
if(!c.a[c.n]) --c.n;
return c;
}
gj operator*(const gj &a,const int &b){
gj c;
c.n=a.n+2;
for(int i=1;i<=a.n;++i){
c.a[i]=b*a.a[i];
}
for(int i=1;i<=c.n;++i){
c.a[i+1]+=c.a[i]/10;
c.a[i]=c.a[i]%10;
}
while(c.n>1){
if(!c.a[c.n]) --c.n;
}
return c;
}
int n;
gj jc[55];
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n;
jc[1].fuzhi(1);
ans.fuzhi(1);
for(int i=2;i<=n;++i){
jc[i]=jc[i-1]*i;
ans=ans+jc[i];
}
ans.shch();
return 0;
}
自己完全看不出哪里超时了……请求大佬为我指路orz