hdu1008

时间:2021-01-02 07:53:20

//c++
//

#include
using namespace std;
int main(){
int n,j,t,start;
while (cin >> n,n){
start =0;
t = 0;
while(n--){
cin >> j;
if (j>start){
t += 6*(j-start);
}
else if (j < start){
t += 4 *(start-j);
}
start = j;
t +=5;
}

cout << t <<endl; 

}
return 0;

}

相关文章