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 }
本文转自ZH奶酪博客园博客,原文链接:http://www.cnblogs.com/CheeseZH/archive/2012/05/26/2519660.html,如需转载请自行联系原作者