#P1399. [NOI2013] 快餐店
[NOI2013] 快餐店
Description
Xiao T plans to open a delivery fast food restaurant in city C. The time to deliver to a location is proportional to the length of the shortest path from the restaurant to that location. Xiao T wants to choose a location that minimizes the distance to the farthest customer.
Customers are located in buildings in city C. These buildings are connected by exactly bidirectional roads. No two roads connect the same pair of buildings. Between any two buildings, there exists at least one path formed by bidirectional roads. The restaurant can be placed at any building, or at any point on any road (the distances from that point to the two endpoints of the road do not need to be integers).
Given the map of city C (the road layout and lengths), find the optimal location for the restaurant and output its distance to the farthest customer.
Input Format
The first line contains an integer , representing the number of buildings in city C. There are also exactly bidirectional roads.
The next lines each contain integers, (, ), indicating that there is a road between buildings and with length .
Output Format
Output a single real number, rounded and kept to exactly one decimal place, representing the distance from the optimal restaurant location to its farthest customer.
Note: Your result must have exactly one digit after the decimal point. An incorrect number of decimal places will receive no credit.
4
1 2 1
1 4 2
1 3 2
2 4 1
2.0
5
1 5 100
2 1 77
3 2 80
4 1 64
5 3 41
109.0
Hint
- Sample Explanation 1.

- Sample Explanation 2.

- Constraints:
- For of the testdata, , .
- For of the testdata, , .
- For of the testdata, , .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号