-->
当前位置:首页 > 题库

PROGRAMMING:Yacht hire

Luz5年前 (2021-05-10)题库437
Title Source: Wang Xiaodong, algorithm design and analysis
Changjiang yacht club has set up n yacht rental stations 1, 2,..., N on the Yangtze River. Tourists can rent yachts at these yacht rental stations and return them at any downstream yacht rental station. The rent between yacht rental station I and yacht rental station J is R (I, J), 1 < = I < J < = n. Try to design an algorithm to calculate the minimum rent from yacht rental station 1 to yacht rental station n.
###Input format:
In line 1, there is a positive integer n (n < = 200), which means there are n yacht rental stations. Next, line 1 to line n-1. Line I represents the rents from station I to station I + 1, station I + 2,..., and station n.
###Output format:
Output the minimum rent required from yacht rental station 1 to yacht rental station n.
###Input example:
Here is a set of inputs. For example:
```in
three
5 15
seven
```
###Output example:
The corresponding output is given here. For example:
```out
twelve
```







answer:If there is no answer, please comment