#include<stdio.h>
int main(){
int i, n, now=0, temp, ans=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&temp);
if(temp>now){ans+=(temp-now)*6;ans+=5;}
else {ans+=(now-temp)*4;ans+=5;}
now=temp;
}
printf("%d\n",ans);
return 0;
}
PAT-A1008
最新推荐文章于 2022-11-13 18:09:59 发布