双层循环过不了?本人50分
查看原帖
双层循环过不了?本人50分
929308
yanghezong楼主2023/7/20 14:28


∑∑ (嗨嗨嗨——老六乱入——我叫张子安——我为我自己代言——“藏话”) 双层循环过不了?本人50分 代码如下:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans,S=0;
	cin>>n;
	ans=1;
	for(int i=1;i<=n;++i){
		for(int j=i;j>1;--j){
			ans=ans*j;
		}
		S=S+ans;
		//cout<<ans<<endl;
		ans=1;
	}
	ans=0;
	cout<<S<<endl;
	return 0;
}
//∑








2023/7/20 14:28
加载中...