#include<cstdio>
int main()
{
int now = 0,to;//记录当前和下一个楼层
int up=0, down=0;//记录总共上下楼层数量
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
{
scanf("%d", &to);
if (to > now) up += (to - now);
else down += (now - to);
now = to;
}
int sum = 5 * n + 6 * up + 4 * down;
printf("%d", sum);
return 0;
}
A1008 Elevator (20 分)
最新推荐文章于 2022-02-23 22:22:32 发布