1.题目介绍
2.考察点,难度
模拟现实类,难度易
3.解题代码
#include <iostream>
using namespace std;
int main(){
int N;
cin>>N;
int floor[N+1];
floor[0]=0;
int wait=0, up=0, down=0;
for(int i=1;i<N+1;i++){
cin>>floor[i];
wait+=5;
if(floor[i]>=floor[i-1]){
up+=6*(floor[i]-floor[i-1]);
}
else{
down+=4*(floor[i-1]-floor[i]);
}
}
printf("%d",up+down+wait);
return 0;
}