如上输入,导致输出(按理来说,不应该输出Isosecels triangle)
Acute triangle
Isosceles triangle
Equilateral triangle
// 余弦定理 // 排序
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
// Input data
// Output data
int a, b, c;
cin >> a >> b >> c;
vector<int> nums = {a, b, c};
sort(nums.begin(), nums.end());
if (nums[0] + nums[1] <= nums[2])
{
cout << "Not triangle" << endl;
}
else
{
int middle = pow(nums[0], 2) + pow(nums[1], 2);
if (middle > pow(nums[2], 2))
{
cout << "Acute triangle" << endl;
}
else
{
if (middle == pow(nums[2], 2))
{
cout << "Right triangle" << endl;
}
else
{
cout << "Obtuse triangle" << endl;
}
}
if (a == b && b == c)
{
cout << "Equilateral triangle" << endl;
return 0;
}
else
{
if (a == b || b == c || a == c)
{
cout << "Isosceles triangle" << endl;
}
}
}
return 0;
}