- ACM
这就是海伦公式
- 2024-5-21 22:53:04 @
#include <iomanip>
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
int n;
float a, b, c, p, s;
cout << fixed << setprecision(2); //保留两位小数
cin >> n;
for(int i=0;i<n;i++)
{
cin >> a >> b >> c;
if((a+b>c) && (a+c>b) && (b+c>a))
{
p = (a + b + c)/2;
s = sqrt(p*(p-a)*(p-b)*(p-c));
cout << s << endl;
}
else
cout << "NaN" <<endl;
}
return 0;
}
0 comments
No comments so far...