- P196's solution
-
P196's Solution
- @ 2025-9-7 12:13:15
双循环需要打 场,单循环需要打 场。
场比赛中间有 个 天间隔,因此一共 天。
记得特判 。
#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;
}