PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#FW0000051. 106 dặm đến Chicago (106 miles to Chicago)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
106 dặm đến Chicago (106 miles to Chicago)
106 miles to Chicago
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Undirected roads have independent safe-travel probabilities in percent. Find the maximum probability of successfully travelling from city 1 to city n.
Input
First n m; then m lines u v probabilityPercent (1-based).
Output
Print the maximum probability, expressed as a percentage with six decimal places followed by percent.
Subtasks
- Subtask 1 (40 points): . Vertices are 1-based and each undirected road joins two distinct vertices. Parallel roads are allowed.
- Subtask 2 (60 points): . Vertices are 1-based and each undirected road joins two distinct vertices. Parallel roads are allowed.
Examples
Input
3 3
1 2 80
2 3 50
1 3 30
Output
40.000000 percent
Explanation
Roads 1–2–3 yield 0.8 × 0.5 = 0.4, or 40%, while the direct road yields 30%.