logo AlgoBeat OnlineJudge
登录 注册

[Sleeping Cup #7] A. League Preparation Official

作者: cirrationaler  ·  发布于 2026-07-19 7:08:33  ·  最后修改于 2026-07-19 9:08:36
已通过
审核员:joe_zxq 彩笔 · 2026-07-19 9:08:36

双循环需要打 场,单循环需要打 场。

场比赛中间有 天间隔,因此一共 天。

记得特判

#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("league.in", "r", stdin);
	freopen("league.out", "w", stdout);
	int T;
	cin >> T;
	while (T--)
	{
		long long n;
		cin >> n;
		if (n == 1) cout << 0 << endl;
		if (n >= 2 && n <= 15) cout << n * (n - 1) * 4 - 3 << endl;
		if (n >= 16) cout << n * (n - 1) / 2 * 4 - 3 << endl;
	}
	return 0;
}

暂无评论

登录 后即可评论。