洛谷基础题 -P5717 【深基3.习8】三角形分类
感觉这道题有问题,反正不看第一个数据估计我是做不对,
题目地址:
第一个数据
8 8 8 //输入
//输出,注意顺序,按照输出结果写判断条件顺序
Acute triangle
Isosceles triangl
Equilateral triangle
#include<stdio.h>
int Max(int a,int b,int c)
{
int max = a;
if (max < b) max = b;
if (max < c) max = c;
return max;
}
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if ((b + c) < a || (a + c) < b || (a + b) < c || a <= 0 || b<=0 || c <= 0)
{
printf("Not triangle\n");
}else if (a == Max(a,b,c))
{
if ((b*b + c*c) > a*a)
{
printf("Acute triangle\n");
}else if((b*b + c*c) == a*a)
{
printf("Right triangle\n");
}else{
printf("Obtuse triangle\n");
}
if (b == c)
{
printf("Isosceles triangle\n");
}
}else if (b == Max(a,b,c))
{
if ((a*a + c*c) > b*b)
{
printf("Acute triangle\n");
}else if((a*a + c*c) == b*b)
{
printf("Right triangle\n");
}else{
printf("Obtuse triangle\n");
}
if (a == c)
{
printf("Isosceles triangle\n");
}
}else{
if ((a*a + b*b) > c*c)
{
printf("Acute triangle\n");
}else if((a*a + b*b) == c*c)
{
printf("Right triangle\n");
}else{
printf("Obtuse triangle\n");
}
if (a == b)
{
printf("Isosceles triangle\n");
}
}
if ((a == b) && (b == c))
{
printf("Equilateral triangle\n");
}
}