AcWing 666. 三角形类型
原题链接
简单
作者:
冰语晨星
,
2020-03-05 16:57:08
,
所有人可见
,
阅读 635
#include <bits/stdc++.h>
using namespace std;
int main()
{
double a,b,c;
cin >> a >> b >> c;
if (a < b) swap (a , b);
if (a < c) swap (a , c);
if (b < c) swap (b , c);
if (a >= b + c)
{
cout << "NAO FORMA TRIANGULO" << endl;
return 0;
}
if (a * a == b * b + c * c) cout << "TRIANGULO RETANGULO"<<endl;
if (a * a > b * b + c * c) cout << "TRIANGULO OBTUSANGULO"<<endl;
if (a * a < b * b + c * c) cout << "TRIANGULO ACUTANGULO" << endl;
if (a == b && b == c) cout<< "TRIANGULO EQUILATERO" << endl;
if ((a == b && a != c) || (c == b && a != c))
//经过排序a>=b>=c 所以等腰三角形只能存在a==b 或 b==c的情况。
cout << "TRIANGULO ISOSCELES" <<endl;
return 0;
}