F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Can't be easier

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1203    Accepted Submission(s): 539


Problem Description
I'm sure this problem will fit you as long as you didn't sleep in your High School Math classes.
Yes,it just need a little math knowledge and I know girls are always smarter than we expeted.
So don't hesitate any more,come and AC it!
Tell you three point A,B,C in a 2-D plain,then a line L with a slope K pass through C,you are going to find
a point P on L,that makes |AP| + |PB| minimal.
 

Input
The first line contain a t.
Then t cases followed,each case has two parts,the first part is a real number K,indicating the slope,and the second
part are three pairs of integers Ax,Ay,Bx,By,Cx,Cy(0 <=|Ax|,|Ay|,|Bx|,|By|,|Cx|,|Cy| <= 10000 ).
 

Output
Just out put the minimal |AP| + |PB|(accurate to two places of decimals ).
 

Sample Input
1 2.55 8467 6334 6500 9169 5724 1478
 

Sample Output
3450.55
 

Author
Teddy
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-26 09:50:00, Gzip enabled