#FW0000083. Lộ trình xe buýt rẻ nhất (Cheapest way)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Lộ trình xe buýt rẻ nhất (Cheapest way)
Cheapest way
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A bus company operates named stations with a fee charged at every visited station, including endpoints. Every kilometre of undirected road costs 2 taka. Add 10% profit to the minimum itinerary cost, then divide by the stated bus seat count. For each query output a cheapest station sequence and the price per seat.
Input
First named stations and their fees; then undirected roads stationA stationB kilometres; then requests source target seatCount. Station names are distinct tokens, and seat count is positive.
Output
For each query print the station names on a minimum-cost path, then Each passenger has to pay : X.XX taka, with exactly two decimal digits.
Subtasks
-
Subtask 1 (40 points): . , , mạng liên thông, phí trạm và số km nguyên dương , .
-
Subtask 2 (60 points): . , , mạng liên thông, phí trạm và số km nguyên dương , .
Examples
Input
3
A 5
B 8
C 10
3
A B 12
B C 10
A C 30
2
A C 30
A B 30
Output
A B C
Each passenger has to pay : 2.46 taka
A B
Each passenger has to pay : 1.36 taka
Explanation
Route A B C covers 22 km, costing 44 taka in fuel; station fees total 23. With 10% profit and 30 seats the fare is 67×1.1/30=2.46 after rounding.