求助
查看原帖
求助
677581
_Glassy_Sky_楼主2023/9/5 19:39
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	long long n, ans = 0, tot;
	cin >> n;
	for(int i = 1; ; i ++)
		if((1 + i) * i / 2 >= n)
		{
			tot = i;
			break;
		}
	for(int i = 1; i <= tot; i ++)
		ans += pow(i, i);
	cout << ans;
	return 0;
}

2023/9/5 19:39
加载中...