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

Install Air Conditioning

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 2846    Accepted Submission(s): 710


Problem Description

  NJUST carries on the tradition of HaJunGong. NJUST, who keeps up the ¡±people-oriented, harmonious development¡± of the educational philosophy and develops the ¡±unity, dedication, truth-seeking, innovation¡± school motto, has now become an engineering-based, multidisciplinary university.

  As we all know, Nanjing is one of the four hottest cities in China. Students in NJUST find it hard to fall asleep during hot summer every year. They will never, however, suffer from that hot this year, which makes them really excited. NJUST¡¯s 60th birthday is approaching, in the meantime, 50 million is spent to install air conditioning among students dormitories. Due to NJUST¡¯s long history, the old circuits are not capable to carry heavy load, so it is necessary to set new high-load wires. To reduce cost, every wire between two dormitory is considered a segment. Now, known about all the location of dormitories and a power plant, and the cost of high-load wire per meter, Tom200 wants to know in advance, under the premise of all dormitories being able to supply electricity, the minimum cost be spent on high-load wires. And this is the minimum strategy. But Tom200 is informed that there are so many wires between two specific dormitories that we cannot set a new high-load wire between these two, otherwise it may have potential risks. The problem is that Tom200 doesn¡¯t know exactly which two dormitories until the setting process is started. So according to the minimum strategy described above, how much cost at most you'll spend?
 

Input
  The first line of the input contains a single integer T(T ¡Ü 100), the number of test cases.
  For each case, the first line contains two integers n(3 ¡Ü n ¡Ü 1000), k(1 ¡Ü k ¡Ü 100). n represents n-1 dormitories and one power plant, k represents the cost of high-load wire per meter. n lines followed contains two integers x, y(0 ¡Ü x, y ¡Ü 10000000), representing the location of dormitory or power plant. Assume no two locations are the same, and no three locations are on a straight line. The first one is always the location of the power plant.
 

Output
  For each case, output the cost, correct to two decimal places.
 

Sample Input
2 4 2 0 0 1 1 2 0 3 1 4 3 0 0 1 1 1 0 0 1
 

Sample Output
9.66 9.00
 

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-05-09 00:42:03, Gzip enabled