Run ID:104703
提交时间:2025-01-08 20:16:09
#include <iostream> #include <cmath> // 用于使用绝对值函数 std::abs using namespace std; // 判断三角形类型 string triangleType(int a, int b, int c) { if (a * a == b * b + c * c) { // 勾股定理 return "good"; } else if (a == b || b == c || a == c) { // 等腰三角形 return "perfect"; } else { return "just a triangle"; } } int main() { int t; cin >> t; // 读取测试样例的数量 while (t--) { int a, b, c; cin >> a >> b >> c; // 读取三角形的三条边长 cout << triangleType(a, b, c) << endl; // 输出三角形类型 } return 0; }