Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
86320 sh25_wuyy 高精度阶乘的和 C++ 通过 0 MS 260 KB 668 2026-03-29 15:48:25

Tests(4/4):


#include<iostream> #include<vector> using namespace std; int main(){ int n; cin>>n; int fac[100]={0}; int sum[100]={0}; fac[0]=1; int len=1; for(int i=1;i<=n;i++){ int carry=0; for(int j=0;j<100;j++){ int temp=fac[j]*i+carry; fac[j]=temp%10; carry=temp/10; }int ad_carry=0; for(int j=0;j<100;j++){ int temp=sum[j]+fac[j]+ad_carry; sum[j]=temp % 10; ad_carry=temp/10; } }int pos=99; while(pos>0&&sum[pos]==0)pos--; for(int i=pos;i>=0;i--){ cout<<sum[i]; }cout<<endl; return 0; }


测评信息: