AcWing 666. 三角形类型
原题链接
困难
作者:
Asiim0v
,
2020-08-20 23:09:14
,
所有人可见
,
阅读 437
C++ 代码
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<double> vec;
double x;
for(int i = 0; i < 3; ++i)
{
cin >> x;
vec.push_back(x);
}
sort(vec.begin(),vec.end(),greater<double>());
double a = vec[0], b = vec[1], c = vec[2];
if(a >= b+c) cout << "NAO FORMA TRIANGULO" << endl;
else
{
if(a*a == b*b + c*c) cout << "TRIANGULO RETANGULO" << endl;
else if(a*a > b*b + c*c) cout << "TRIANGULO OBTUSANGULO" << endl;
else if(a*a < b*b + c*c) cout << "TRIANGULO ACUTANGULO" << endl;
if(a == c) cout << "TRIANGULO EQUILATERO" << endl;
else if(a == b || b == c) cout << "TRIANGULO ISOSCELES" << endl;
}
return 0;
}