Goat Rope | 프로그래밍의 벗 PivotOJ
PivotOJ

Goat Rope

시간 제한: 2000ms메모리 제한: 512MB출처: ICPC Mid-Central Regional 2018BOJ 16410

문제

You have a fence post located at the point (x, y) in the plane, to which a goat is tethered by a rope. You also have a house, which you model as an axis-aligned rectangle with diagonally opposite corners at the points (x1, y1) and (x2, y2). You want to pick a length of rope that guarantees the goat cannot reach the house. Determine the minimum distance from the fence post to the house, so that you can make sure to use a shorter rope.

입력

The input consists of a single line containing six space-separated integers x, y, x1, y1, x2, and y2, each in the range [−999, 999].

It is guaranteed that x1 < x2 and y1 < y2, and that (x, y) is strictly outside the axis-aligned rectangle with corners at (x1, y1) and (x2, y2).

출력

Print the minimum distance from the goat’s post to the house, with a relative or absolute error no more than 0.001.

예제

예제 1

입력
7 3 0 0 5 4
출력
2.0

예제 2

입력
6 0 0 2 7 6
출력
2.0

예제 3

입력
3 -4 -3 -1 -1 2
출력
5.0

예제 4

입력
7 4 0 0 5 4
출력
2.000

예제 5

입력
4 8 7 8 9 9
출력
3.000
코드를 제출하려면 로그인하세요.