游历
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.
Description
有 个城市,坐落在一条直线上,我们用坐标表示他们的位置,第 个城市坐落在位置 处,
现在机智的希望从游历完这个城市,即先后到过这个城市。
机智的可以选择任何一个城市出发,在直线上每移动一个单位会消耗 卡路里,当然强大的会使用魔法,他也可从一个城市瞬移到另一个城市,这样会消耗 卡路里。
胖胖的问你他游历完个城市的最少消耗卡路里是多少?
每天赖在床上不想起
吃饱了以后就想休息
咖啡薯条还有雪碧
感觉与奋斗隔着距离
要把计划定制的合理
每天早上六点钟就起
...
这个寒假已经开始了他的游历,你呢?
Format
Input
第一行三个整数 , ,
第二行 的整数表示
Output
一个整数表示答案
Samples
样例输入 1
4 2 5
1 2 5 7
样例输出 1
11
样例解释 1
从 2号城市出发,移动一个单位到1号城市,消耗 2个卡路里
从1号城市 瞬间移动到 3号城市,消耗 5个卡路里
从3号城市 移动2个单位 到 4号城市,消耗 4个卡路里
因此 2 + 5 + 4 = 11
样例输入 2
7 1 2
24 35 40 68 72 99 103
样例输出 2
12
Limitation
的数据满足 , ,
20241128周赛
- Status
- Done
- Rule
- IOI
- Problem
- 6
- Start at
- 2024-11-28 16:30
- End at
- 2024-11-28 18:30
- Duration
- 2 hour(s)
- Host
- Partic.
- 25