Advertisement
lalalalalalalaalalla

Untitled

Feb 6th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. struct Point {
  2. int x, y;
  3. Point() {}
  4. Point(int x_, int y_) {x = x_; y = y_;}
  5. };
  6.  
  7. istream& operator>> (istream& a, Point& b) {
  8. cin >> b.x >> b.y;
  9. return a;
  10. }
  11.  
  12. ostream& operator<< (ostream& a, const Point& b) {
  13. cout << b.x << " " << b.y;
  14. return a;
  15. }
  16.  
  17. int operator% (const Point& a, const Point& b) {
  18. return (a.x * b.x + a.y * b.y) >= 0;
  19. }
  20.  
  21. int operator* (const Point& a, const Point& b) {
  22. return a.x * b.y - a.y * b.x;
  23. }
  24.  
  25. inline int sq(int x) {return x * x;}
  26.  
  27. inline int dist(const Point& a, const Point& b) {
  28. return sq(a.x - b.x) + sq(a.y - b.y);
  29. }
  30.  
  31. inline Point vec(const Point& a, const Point& b) {
  32. return Point(b.x - a.x, b.y - a.y);
  33. }
  34.  
  35. signed main() {
  36. ios_base::sync_with_stdio(0);
  37. cin.tie(0);
  38. cout.tie(0);
  39. Point a, b, c;
  40. cin >> a >> b >> c;
  41. int l;
  42. cin >> l;
  43. Point ab = vec(a, b), ac = vec(a, c), bc = vec(b, c), ba = vec(b, a);
  44. dbg(dist(a, c))
  45. dbg(dist(b, c))
  46. ld ans = sqrt(min(dist(a, c), dist(b, c)));
  47. if (ac % ab == ba % bc) {
  48. ans = min(ans, (ld)abs(ab * ac) / (ld)sqrt(dist(a, b)));
  49. }
  50. cout << fixed << setprecision(10) << max(ans - (ld)l, (ld)0) << "\n" << max(sqrt(max(dist(a, c), dist(b, c))) - (ld)l, (ld)0);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement