标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 52791 Accepted Submission(s): 29174
1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 int main() 5 { 6 int n,m,i,j; 7 while(~scanf("%d",&n)&&n) 8 { 9 int sum=0,t=0; 10 while(n--) 11 { 12 scanf("%d",&m); 13 if(m>t) //上楼 14 sum=sum+(m-t)*6; 15 else //下楼 16 sum=sum+(t-m)*4; 17 sum+=5; //每次停留需要5秒 18 t=m; 19 } 20 printf("%d\n",sum); 21 } 22 }
标签:
原文地址:http://www.cnblogs.com/pshw/p/4760210.html