F. [USACO08FEB] Making the Grade G
[USACO08FEB] Making the Grade G
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
农夫约翰想改造一条长度为 的路,原来的路的每一段海拔是 ,修理后是 ,花费 。我们要求修好的路,即你构造的 ,是单调不升或者单调不降的。求最小花费 。
输入格式
第一行包含一个整数 。
接下来 行,每行包含一个整数 。
输出格式
一行一个整数,表示最小花费。
7
1
3
2
4
5
3
9
3
提示
数据范围为 。
2025CSP-J DP【李】
- Status
- Done
- Problem
- 28
- Open Since
- 2025-10-14 0:00
- Deadline
- 2025-10-21 23:59
- Extension
- 24 hour(s)