📄 1008 elevator.cpp
字号:
/*
1008 Elevator
Time Limit : 1000 ms Memory Limit : 32768 K Output Limit : 1024 K
GUN C++
*/
#include <iostream.h>
using namespace std;
#define NMAX 100
int main()
{
int n,ca,floorth,goal,mins;
while(cin>>n && n!=0)
{
if(n>NMAX)
continue;
floorth=0;mins=0;
for(ca=0;ca<n;ca++)
{
cin>>goal;
if(goal>floorth)
mins+=6*(goal-floorth);
else
if(goal<floorth)
mins+=4*(floorth-goal);
mins+=5;
floorth=goal;
}
cout<<mins<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -