#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 100010;
int main()
{
int n,s[N]={0},ans=0;
scanf("%d",&n);
s[0]=0;
for(int i = 1;i<=n;i++)
{
scanf("%d",&s[i]);
if(s[i]>s[i-1])
ans+=(s[i] - s[i-1]) * 6 + 5;
else
ans+=(s[i-1] - s[i]) * 4 + 5;
}
printf("%d",ans);
return 0;
}
5.1 1008 Elevator (20 分)
最新推荐文章于 2022-03-10 09:38:18 发布