Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110173 | 汤奕硕 | 判断三角形形状 | C++ | Accepted | 3 MS | 276 KB | 1044 | 2025-02-15 13:13:03 |
#include <iostream> #include <algorithm> using namespace std; int main() { int t; cin >> t; // 读取测试样例的数量 while (t--) { int a, b, c; cin >> a >> b >> c; // 读取三角形的三条边 // 对边长进行排序,确保 c 是最长边 int sides[3] = {a, b, c}; sort(sides, sides + 3); a = sides[0]; b = sides[1]; c = sides[2]; // 判断三角形类型 if (a == b || b == c || a == c) { // 等腰三角形 if (a * a + b * b == c * c) { // 等腰直角三角形 cout << "good" << endl; } else { // 等腰三角形 cout << "perfect" << endl; } } else if (a * a + b * b == c * c) { // 直角三角形 cout << "good" << endl; } else { // 普通三角形 cout << "just a triangle" << endl; } } return 0; }