个人标记下
# include <cstdio>
# include <iostream>
using namespace std;
int main(){
float eps = 1e-6;
float a, b, c, tmp;
scanf ("%f %f %f", &a, &b, &c);
if (b > a && b > c) tmp = a, a = b, b = tmp;
if (c > b && c > a) tmp = a, a = c, c = tmp;
if (b < c) tmp = b, b = c, c = tmp;
if (abs(a - b - c) < eps){
printf("NAO FORMA TRIANGULO\n");
}
else{
if (abs(a * a - b * b - c * c) < eps){
printf("TRIANGULO RETANGULO\n");
}
else if (a * a > b * b + c * c){
printf("TRIANGULO OBTUSANGULO\n");
}
else if (a * a < b * b + c * c){
printf("TRIANGULO ACUTANGULO\n");
}
if (abs(a - b) < eps && abs(b - c) < eps){
printf("TRIANGULO EQUILATERO\n");
}
else if (abs(a - b) < eps
|| abs(b - c) < eps
|| abs(c - a) < eps ){
printf("TRIANGULO ISOSCELES\n");
}
}
return 0;
}
作者:adnil8130
链接:https://www.acwing.com/activity/content/code/content/221443/
来源:AcWing