标签:input 图片 http ++ put can space code NPU
思路:海伦公式,
AC代码:
1 #include<bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 double ha, hb, hc, a, b, c; 8 while(~scanf("%lf %lf %lf",&ha,&hb,&hc)) 9 { 10 a = 2.0 / ha; 11 b = 2.0 / hb ; 12 c = 2.0 / hc; 13 if(a <= 0.0 || b <= 0.0 || c <= 0.0 || a >= b+c || b >= a+c || c >= a+b ) 14 { 15 printf("These are invalid inputs!\n"); 16 } 17 else { 18 double p = (a + b + c)*0.5; 19 double s = p * (p - a)*(p - b)*(p - c); 20 printf("%.3f\n",sqrt(1.0 / s)); 21 } 22 } 23 return 0; 24 }
UVA 10522 Height to Area(知三角形三高求面积)
标签:input 图片 http ++ put can space code NPU
原文地址:https://www.cnblogs.com/Carered/p/11406630.html