#include<stdio.h>
#include<math.h>
int main()
{
int n,temp;
double a,b,c,p,s;
scanf("%d",&n);
while(n--)
{
scanf("%lf%lf%lf",&a,&b,&c);
//排序 a>=b>=c
if(a<b)
{
temp=a;
a=b;
b=temp;
}
if(a<c)
{
temp=a;
a=c;
c=temp;
}
if(b<c)
{
temp=b;
b=c;
c=temp;
}
//判断是否是三角形
if (a<0||b<0||c<0||b+c<=a)
{
printf("NaN\n");
}
else
{
p=1.0/2*(a+b+c);
s=sqrt(p*(p-a)*(p-b)*(p-c));
printf("%.2f",s);
}
}
return 0;
}
机试题2019-2
猜你喜欢
转载自blog.csdn.net/chenyx1998/article/details/104919522
今日推荐
周排行