《补题》(牛客小白月赛67:一刀二分三角)

103 阅读1分钟

思维

先化简,少使用除法

#include <bits/stdc++.h>

using i64 = long long;

void solve() {
	double xb, xc, yc;
	std::cin >> xb >> xc >> yc;

	for (int i = 1; i <= xc; i ++) {
		if (i * i * 2 == xb * xc) {
			std::cout << "YES" << "\n";
			return;
		}
	}

	xc = xb - xc;

	for (int i = 1; i <= xc; i ++) {
		if (i * i * 2 == xb * xc) {
			std::cout << "YES" << "\n";
			return;
		}
	}

	std::cout << "NO" << "\n";
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int t;
	std::cin >> t;

	while (t --) {
		solve();
	}

	return 0;
}