循环的都是渣渣

☀️☃️☃️☃️☀️  •  4个月前


#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int k = 0,restday;
	cin >> k;
	int round = sqrt(k * 2);
	if (round * (round + 1) / 2 > k) round--;
	restday = k - round * (round + 1) / 2;
	cout << 1ll * round * (round + 1) * (round * 2 + 1) / 6 + (round + 1) * restday;
}

评论:

请先登录,才能进行评论