Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Point {
- int x, y;
- Point() {}
- Point(int x_, int y_) {x = x_; y = y_;}
- };
- istream& operator>> (istream& a, Point& b) {
- cin >> b.x >> b.y;
- return a;
- }
- ostream& operator<< (ostream& a, const Point& b) {
- cout << b.x << " " << b.y;
- return a;
- }
- int operator% (const Point& a, const Point& b) {
- return (a.x * b.x + a.y * b.y) >= 0;
- }
- int operator* (const Point& a, const Point& b) {
- return a.x * b.y - a.y * b.x;
- }
- inline int sq(int x) {return x * x;}
- inline int dist(const Point& a, const Point& b) {
- return sq(a.x - b.x) + sq(a.y - b.y);
- }
- inline Point vec(const Point& a, const Point& b) {
- return Point(b.x - a.x, b.y - a.y);
- }
- signed main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- Point a, b, c;
- cin >> a >> b >> c;
- int l;
- cin >> l;
- Point ab = vec(a, b), ac = vec(a, c), bc = vec(b, c), ba = vec(b, a);
- dbg(dist(a, c))
- dbg(dist(b, c))
- ld ans = sqrt(min(dist(a, c), dist(b, c)));
- if (ac % ab == ba % bc) {
- ans = min(ans, (ld)abs(ab * ac) / (ld)sqrt(dist(a, b)));
- }
- cout << fixed << setprecision(10) << max(ans - (ld)l, (ld)0) << "\n" << max(sqrt(max(dist(a, c), dist(b, c))) - (ld)l, (ld)0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement