标签:
1 #include<stdio.h>/*一道水题,秒杀*/ 2 int main() 3 { 4 int N; 5 while(scanf("%d",&N)==1) 6 { 7 if(N==0) 8 break; 9 int a[101],i,j,time=0,k; 10 a[0]=0; 11 for(i=1;i<=N;i++) 12 scanf("%d",&a[i]); 13 for(i=1;i<=N;i++) 14 time+=(a[i]-a[i-1]>0?(a[i]-a[i-1])*6:(a[i-1]-a[i])*4)+5; 15 printf("%d\n",time); 16 } 17 }
标签:
原文地址:http://www.cnblogs.com/a1225234/p/4496152.html