提交时间:2024-08-20 20:29:41

运行 ID: 169939

#include <iostream> using namespace std; // int len=1,ans[100000]={0,1}; void solve(int num) { int x=0,tmp=len; len+=5; for (int i=1;i<=len;++i) { if (i<=tmp) ans[i]*=num; ans[i]+=x; x=ans[i]/10; ans[i]%=10; } while (len>1 && ans[len]==0) --len; } // int main() { int n; scanf("%d",&n); for (int i=1;i<=n;++i) solve(i); printf("%d!=",n); for (int i=len;i>=1;--i) printf("%d",ans[i]); return 0; }