转载

HDOJ1008 ( Elevator ) 【水题】

Problem : 1008 ( Elevator )     Judge Status : Accepted
RunId : 6005031    Language : C    Author : qq1203456195
Code Render Status : Rendered By HDOJ C Code Render Version 0.01 Beta
 1 #include <stdio.h>
 2 int main()
 3 {
 4     int n,pre,cur,t,m;
 5     while (scanf("%d",&n),n)
 6     {
 7         pre=0;
 8         t=0;
 9         while (n--)
10         {
11             scanf("%d",&cur);
12             m=cur-pre;
13             if(m>0)    t+=m*6;
14             else    t+=m*-4;
15             t+=5;
16             pre=cur;
17         }
18         printf("%d\n",t);
19     }
20     return 0;
21 }

 

转载于:https://www.cnblogs.com/CheeseZH/archive/2012/05/26/2519660.html

正文到此结束
本文目录