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
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 }