# 求帮助
查看原帖
# 求帮助
286213
kaysar楼主2020/5/21 20:36

P1009这样写不对吗,自己调试答案没问题,系统判罚50分,不知道错在哪儿,求大神请教、

#include <iostream>
#include <cstring>//头文件不解释
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;
int main() {
	int n;
	int sum = 0;
	int take = 1;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= i; j++) {
			take = take * j;
		}
		sum += take;
		take = 1;
	}
	cout << sum;
}
2020/5/21 20:36
加载中...