Type: Default 1000ms 256MiB

希蒙爬塔

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.

希蒙爬塔

题目描述

希蒙最近沉迷一个游戏叫做《魔塔》,在这个游戏中,他需要登上一个n层的塔,但是每一层都会消耗希蒙一定的血量,不过希蒙也有通过秘诀,他有一个传送器,每次可以向上传送1层或者2层,但是传送之后必须要冷却一层楼才行,也就是每使用一次传送器,希蒙就得老老实实爬一层塔。 现在需要你帮助希蒙计算一下,爬到顶楼最少消耗多少血量呢。

输入格式

第一行一个数n (n<=1000000),表示塔的层数.

第二行n个数(<=100),表示从下往上每层消耗的血量.

输出格式

一个数,表示最少消耗血量.

样例 #1

样例输入 #1

5
3 5 1 8 4

样例输出 #1

1

AC练习3

Not Claimed
Status
Done
Problem
9
Open Since
2023-5-7 8:00
Deadline
2023-5-15 12:00
Extension
24 hour(s)