HDU1008 Elevator
来源:互联网 发布:thinkphp 商城源码 编辑:程序博客网 时间:2024/05/14 02:02
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1008
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n,curLev,desLev,sumTime,tmp;
while(cin>>n&&n!=0)
{
curLev = 0;//初始层为0
sumTime = 0;
for(int i=0;i<n;++i)
{
cin>>desLev;//目标层
tmp = desLev-curLev;
if(tmp>0)
{//上楼
sumTime += tmp*6+5;
}
else
{//下楼
tmp = -tmp;
sumTime += tmp*4+5;
}
curLev = desLev;//修改当前所在层
}
cout<<sumTime<<endl;
}
return 0;
}
- HDU1008 Elevator
- HDU1008 Elevator
- hdu1008 Elevator
- HDU1008:Elevator
- hdu1008 Elevator
- HDU1008-Elevator
- hdu1008 Elevator
- HDU1008 Elevator
- HDU1008 Elevator
- HDU1008 Elevator
- HDU1008-Elevator
- hdu1008 Elevator
- HDU1008(elevator)
- hdu1008——Elevator
- hdu1008 Elevator(模拟)
- HDU1008—Elevator
- HDU1008 ZOJ2108 Elevator
- HDU1008——Elevator
- HDU1013 Digital Roots
- HDU1007 Quoit Design
- HDU1012 Calculate e
- HDU1010 Tempter of the Bone
- HDU1009 FatMouse' Trade
- HDU1008 Elevator
- HDU1004 Let the Balloon Rise
- HDU1003 最大子序列和问题
- HDU1002 大数相加
- C++ Exercises(七)
- 《Introduction to Computing Systems:From Bits and Gates to C and Beyond》读后感(一)
- An introduction to bitwise operators
- 《C++网络编程》读书笔记(一)
- 【译】Virtual-Machine-based Intrusion Detection on File-aware Block Level Storage