• # hdu 1008 Elevator 的解题报告

本题为一道简单的数学题没什么难的 ；但还是要注意

Problem Description
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop.

For a given request list, you are to compute the total time spent to fulfill the requests on the list. The elevator is on the 0th floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.

Input
There are multiple test cases. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100. A test case with N = 0 denotes the end of input. This test case is not to be processed.

Output
Print the total time on a single line for each test case.

Sample Input
```1 2
3 2 3 1
0```

Sample Output
```17
41```
` 1 #include<stdio.h> 2  int main() 3 { 4     int N,i; 5  6     while( scanf( "%d",&N )&&N>0 ){ 7         int b=0,e=0,s=0; 8         for( i=0;i<N;++i ){ 9             scanf( "%d",&e );10             s+=5;11             if( e>b )12                s+=(e-b)*6;13             else14                 s+=(b-e)*4;15             b=e;//最开始写在下面虽然测试数据能过却一直WA杯具啊;后来发现测试数据全是2个数16         }17         //b=e;18         printf( "%d\n",s );19     }20 }`
• 相关阅读:
记一次手工端假设之旅
宝塔面板相关笔记
linux ubuntu centos 相关笔记
问题解决笔记，Restarting network (via systemctl):: Job for network.service failed. ...
Ubuntu中使用yum
小说爬取 python + urllib + lxml
wsgiref错误解决笔记 "write() argument must be a bytes instance"
个人作品导航：
django基础一
前端小知识（5）--响应式页面实现
• 原文地址：https://www.cnblogs.com/jian1573/p/1999227.html