1346 - Mobile Robot

Time Limit: 1s Memory Limit: 128MB

Submissions: 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