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