#include <iostream>
#include <fstream>
using namespace std;
int main()
{
//ifstream cin("input.txt");
int floor[100],visit[100];
memset(visit,0,sizeof(visit));
int stop=5,upSpeed=6,downSpeed=4,n=0,pre,time;
while (cin>>n&&n)
{
time=0;
for(int i=0;i<n;i++)
cin>>floor[i];
for (int i=0;i<n;i++)
{
if(i==0)
pre=0;
else
pre=floor[i-1];
if(floor[i]>=pre)
time+=(floor[i]-pre)*upSpeed;
else
time+=(pre-floor[i])*downSpeed;
}
time+=n*stop;
cout<<time<<endl;
n=0;
}
return 0;
}
HD1008简单题
最新推荐文章于 2023-10-17 14:24:40 发布