https://www.luogu.com.cn/problem/P10410?contestId=166040
[C++] 纯文本查看 复制代码 #include <bits/stdc++.h>
using namespace std;
inline double cal(double mj, double p) {
return S - 3.0 * (mj * p * (1.0 - p));
}
int main() {
double l, r, x1, y1, x2, y2, x3, y3,a,b,c,p,s,k = 0.5;
cin >> l >> r >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
b = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
c = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
p = (a + b + c) * 0.5;
s = sqrt(p * (p - a) * (p - b) * (p - c)); //面积
k = min(k, r);
k = max(k, l);
cout << fixed << setprecision(12) << cal(s, k) << endl;
return 0;
}
|