标签:lang ios out signed sign cout 偶数 line include
给定 N,求有多少 a,b,c 满足 \(a \le b \le c \le n, a^2 + b^2 = c^2, a^2 - b = c\)
对于每个大于 1 的奇数 a,恰好有一个 b 和一个 c 与之对应,偶数无
a 的最大值显然是 \(\sqrt {2n-1}\)
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
ios::sync_with_stdio(false);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
cout << ((int)sqrt(2 * n - 1) - 1) / 2 << endl;
}
}
标签:lang ios out signed sign cout 偶数 line include
原文地址:https://www.cnblogs.com/mollnn/p/14434462.html