Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Paid Roads
Description A network of b:_{i}- in advance, in a city
**c**(which may or may not be the same as_{i}**a**);_{i} - after the travel, in the city
**b**._{i}
The payment is R in the second case._{i}Write a program to find a minimal-cost route from the city 1 to the city Input The first line of the input contains the values of b, _{i}c, _{i}P, _{i}R (1 ≤ _{i}i ≤ m). Adjacent values on the same line are separated by one or more spaces. All values are integers, 1 ≤ m, N ≤ 10, 0 ≤ P , _{i}R ≤ 100, _{i}P_{i} ≤ R (1 ≤ _{i}i ≤ m).Output The first and only line of the file must contain the minimal possible cost of a trip from the city 1 to the city Sample Input 4 5 1 2 1 10 10 2 3 1 30 50 3 4 3 80 80 2 1 2 10 10 1 3 2 10 50 Sample Output 110 Source Northeastern Europe 2002, Western Subregion |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator