AcWing 666. 三角形类型
原题链接
简单
作者:
深街酒徒
,
2024-11-18 18:28:48
,
所有人可见
,
阅读 1
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
double a, b, c;
cin >> a >> b >> c;
//排序
if(b > a)
{
double t = b;
b = a;
a = t;
}
if (c > a)
{
double t = c;
c = a;
a = t;
}
if (c > b)
{
double t = b;
b = c;
c = t;
}
//逻辑的判断
if(a >= b + c) cout << "NAO FORMA TRIANGULO" << endl;
else
{
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;
else if(a == b || a == c || c == b)
cout << "TRIANGULO ISOSCELES" << endl;
return 0;
}