#include<iostream>
using namespace std;
int main()
{
int n;
int cur = 0;
int floor;
int total = 0;
int tmp;
cin>>n;
for(int i=0; i<n; ++i)
{
cin>>floor;
tmp = floor - cur;
total += (tmp > 0 ? tmp * 6 : tmp * (-4));
cur = floor;
}
total += n * 5;
cout<<total<<endl;
return 0;
}
PAT 1008 Elevator
最新推荐文章于 2019-10-09 20:28:31 发布