Mobile Robot

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 226

Solved: 54

Description
Our base recently developed a robot combating system. The combating system contains two straight tracks with finite non-negative length in 2D plane (say AB and CD). There is one robot in each of them, and each robot can move freely on the track. When the two robots are combating, they can disturb each other by sending radio-waves to each other. Sometimes they want to defend, and sometimes they want to offense, so each robot are very concerned with the distance between them. As an administrator of this system, please calculate the maximum possible distance and the minimum possible distance between two robots.
Input
The input contains multiple cases terminated with EOF.
Each case has only one line with 8 integers (absolute value not exceeding 100)
—— coordinate of the end points of two tracks:
XA YA XB YB XC YC XD YD
Output
The output of each case should have one line, containing two numbers, with 3 digits after the dot:
Case #i: max_distance min_distance
sample input
0 1 0 -1 -1 0 1 0
0 0 0 1 2 0 1 1
sample output
Case #1: 1.414 0.000
Case #2: 2.236 1.000
hint
source
Xu Han, HUST Campus 2009
© 2015 HUST ACMICPC TEAM. All Right Reserved.