pat甲级打卡-1008 Elevator
简单题
#include<bits/stdc++.h>
using namespace std;
int n,cnt;
int main(){
cin>>n;
int pre=0;
while(n--){
int tmp;
cin>>tmp;
if(tmp>pre) cnt+=(tmp-pre)*6;
else cnt+=(pre-tmp)*4;
cnt+=5;
pre=tmp;
}
cout<<cnt;
return 0;
}