// 1008. Elevator.cpp: 主项目文件。
#include "stdafx.h"
#include <cstdio>
int main()
{
int n;
scanf("%d",&n);
int sum=sum=5*n,pre=0;
for(int i=0;i<n;i++){
int temp;
scanf("%d",&temp);
if(temp>pre)
sum+=6*(temp-pre);
else
sum+=4*(pre-temp);
pre=temp;
}
printf("%d\n",sum);
return 0;
}
1008. Elevator
最新推荐文章于 2024-02-22 13:06:11 发布