jikky @ 2024-07-04 09:16:29
#include<bits/stdc++.h>
using namespace std;
string a,b;
int c[50000001];
int g[50000005];
int ans[50000005];
int main(){
int n;
cin>>n;
for(int i=n;i>=1;i--){
c[i]=i;
}
int p=1;
g[1]=1;
while(n){
for(int j=1;j<=n;j++){
for(int i=1;i<=p;i++){
g[i]*=c[j];
}
for(int i=1;i<p;i++){
if(g[i]>9){
g[i+1]+=g[i]/10;
g[i]%=10;
}
}
if(g[p]>9){
g[p+1]+=g[p]/10;
g[p]%=10;
p++;
}
}
for(int i=1;i<=p;i++){
ans[i]+=g[i];
if(ans[i]>9){
ans[i+1]+=ans[i]/10;
ans[i]%=10;
}
}
for(int i=1;i<=p;i++){
g[i]=0;
}
g[1]=1;
n--;
}
int l=p*3;
while(ans[l]==0&&l>1){
l--;
}
for(int i=l;i>=1;i--){
cout<<ans[i];
}
return 0;
}
by ChasonWang @ 2024-07-12 10:27:11
hack:
in:48
out:12678163798554051767172643373255731925167694226950680420940313