#P1359. 租用游艇
租用游艇
Description
The Yangtze River Yacht Club has set up yacht rental stations along the Yangtze River. Tourists can rent a yacht at any of these stations and return it at any downstream station. The rent between yacht rental station and yacht rental station is (). Design an algorithm to compute the minimum total rent needed to travel from yacht rental station to yacht rental station .
Input Format
The first line contains a positive integer , indicating there are yacht rental stations.
The next lines give a half matrix (): for each from to , the -th of these lines contains integers .
Output Format
Output the minimum total rent required to travel from yacht rental station to yacht rental station .
3
5 15
7
12
Hint
, and it is guaranteed that at any time during the computation, all numbers do not exceed .
Translated by ChatGPT 5
京公网安备 11011102002149号