|  | 
|  | 
| вернуться в форум | Acceepted #include <iostream>#include <cmath>
 #include <vector>
 #include <algorithm>
 #include <string>
 #include <iomanip>
 #include <set>
 using namespace std;
 int main()
 {
 int x1, x2, y1, y2, x3, y3, l;
 cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> l;
 // h = 2/s3 в€љp(p-s3)(p-s1)(p-s2),
 int a = y1 - y2, b = x2 - x1, c = x1 * y2 - x2 * y1;
 double s1 = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)),
 s2 = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)),
 s3 = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
 double p = s1 + s2 + s3; p /= 2;
 double ans = (2 / s3 * sqrt(p * (p - s3) * (p - s1) * (p - s2)));
 if (max(s1, s2) * max(s1, s2) > min(s1, s2) * min(s1, s2) + s3 * s3) {
 ans = min(sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)), sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)));
 }
 if (s3 == 0.0) {
 ans = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) *(y1 - y3));
 }
 printf("%0.2f\n", max(0.0, ans - l));
 printf("%0.2f\n", max(0.0, max(sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)), sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3))) - l));
 }
 | 
 | 
|