a20111127 @ 2024-08-20 20:00:24
using namespace std; int main(){ int n,s=0,t=1; cin>>n; for(int i=1;i<=n;i++){ int t=1; for(int j=i;j>=1;j--){ t=t*j; } s=s+t; } cout<<s; }```c
using namespace std; int main(){ int n,s=0,t=1; cin>>n; for(int i=1;i<=n;i++){ int t=1; for(int j=i;j>=1;j--){ t=t*j; } s=s+t; } cout<<s; }
by a20111127 @ 2024-08-20 20:01:00
using namespace std; int main(){ int n,s=0,t=1; cin>>n; for(int i=1;i<=n;i++){ int t=1; for(int j=i;j>=1;j--){ t=t*j; } s=s+t; } cout<<s; }```c
using namespace std; int main(){ int n,s=0,t=1; cin>>n; for(int i=1;i<=n;i++){ int t=1; for(int j=i;j>=1;j--){ t=t*j; } s=s+t; } cout<<s; }
by wh233 @ 2024-08-20 20:01:31
@a20111127 高精度的题不学高精度?
by _hsk121212_ @ 2024-08-20 20:01:38
@a20111127 望丰展?使MD
by Dejected @ 2024-08-20 20:01:47
@a20111127 用python,自带高精度
by lccjsw @ 2024-08-20 20:02:11
@a20111127 ac:求关 我来帮助你
#include<bits/stdc++.h>
using namespace std;
int a[100000],n,i,y,xy[100000],s[100000];
void add()
{
int i;
memset(xy,0,sizeof(xy));
xy[0]=max(s[0],a[0]);
for (i=1;i<=xy[0];i++)
{
xy[i]+=s[i]+a[i];
xy[i+1]=xy[i]/10;
xy[i]%=10;
}
while (xy[xy[0]+1]>0)
{
xy[xy[0]+2]=xy[xy[0]+1]/10;
xy[xy[0]+1]%=10;
xy[0]++;
}
s[0]=xy[0];
for (i=1;i<=xy[0];i++) s[i]=xy[i];
}
int main()
{
cin>>n;
a[0]=1;
a[1]=1;
s[0]=1;
s[1]=0;
for (y=1;y<=n;y++)
{
memset(xy,0,sizeof(xy));
xy[0]=a[0];
for (i=1;i<=a[0];i++)
{
xy[i]+=a[i]*y;
xy[i+1]=xy[i]/10;
xy[i]%=10;
}
while (xy[xy[0]+1]>0)
{
xy[xy[0]+2]=xy[xy[0]+1]/10;
xy[xy[0]+1]%=10;
xy[0]++;
}
for (i=1;i<=xy[0];i++) a[i]=xy[i];
a[0]=xy[0];
add();
}
for (i=s[0];i>=1;i--) cout<<s[i];
cout<<endl;
return 0;
}
by zhanghengrui0502 @ 2024-08-20 20:05:50
#include<bits/stdc++.h>
using namespace std;
int a[10000],k=1,n;
int main(){
cin>>n;
for(int i=n;i>=1;i--){
a[1]++;
for(int j=1;j<=a[0];j++){
a[j+1]+=a[j]/10;
a[j]%=10;
}
if(a[a[0]+1]>0)a[0]++;
for(int j=1;j<=a[0];j++)a[j]*=i;
for(int j=1;j<=a[0];j++){
a[j+1]+=a[j]/10;
a[j]%=10;
}
int x=a[0]+1;
if(a[x]>0){
while(a[x]>10){
a[x+1]=a[x]/10;
a[x]%=10;
x++;
}
a[0]=x;
}
}
for(int i=a[0];i>=1;i--)cout<<a[i];
return 0;
}
by zhanghengrui0502 @ 2024-08-20 20:06:29
给你发了个解法,求关~~~
by ningago @ 2024-08-20 20:10:48
去学高精度
by YWHHDJSer @ 2024-08-20 20:23:33
推销:__int1024
by a20111127 @ 2024-08-20 22:00:10
@lccjsw 已关