#include <iostream>
using namespace std;
int main(){
int nowfloor, list[100], n, sumtime;
while( cin >> n && n != 0 ){
for( int i = 0; i < n; i++ ){
cin >> list[i];
}
nowfloor = sumtime = 0;
for( int i = 0; i < n; i++ ){
if( list[i] > nowfloor ){
sumtime += ( list[i] - nowfloor ) * 6 + 5;
}else{
sumtime += ( nowfloor - list[i] ) * 4 + 5;
}
nowfloor = list[i];
}
cout << sumtime << endl;
}
return 0;
}
hdu 1008 简单题
最新推荐文章于 2021-09-09 19:04:41 发布