#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,sum=0;
	cin>>n;
	int k=n;
	while(n-1!=0)  //当n大于0的情况下 
	{
		for(int i=n-1;i>0;i--)   //从这个数本身往1乘 
		k=k*i;  //5*4*3*2*1
     sum=sum+k;
     
	n--;
}
	cout<<sum;
	

	
	
	return 0;
}

1 comments

  • @ 2024-1-6 16:26:48

    跟题解的思路不太一样,不太清楚自己的问题,求助各位大佬

    • 1

    Information

    ID
    585
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    105
    Accepted
    73
    Uploaded By