标签:理解 结束 lin amp http show mission 自己 include
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 19097 Accepted Submission(s): 7065
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2059
1 #include<cstdio> 2 3 int main() 4 { 5 int L,n,c,t,v0,v1,v2; 6 int p[105]; 7 double dp[105]; 8 while(~scanf("%d",&L)) 9 { 10 scanf("%d%d%d%d%d%d",&n,&c,&t,&v0,&v1,&v2); 11 for(int i=1;i<=n;i++) 12 scanf("%d",&p[i]); 13 p[n+1]=L;p[0]=0;dp[0]=0;//初始化起点和终点,dp[0] 14 double T1=L*1.0/v0;//兔子匀速到达的时间 15 for(int i=1;i<=n+1;i++) 16 { 17 double min=88888888; 18 for(int j=0;j<i;j++) 19 { 20 double dis=p[i]-p[j],t2; 21 if(dis<=c) 22 t2=dis/v1; 23 else 24 t2=c*1.0/v1+(dis-c)*1.0/v2; 25 if(j)//如果j = 0,起点不需要充电的时间 26 t2+=t; 27 t2+=dp[j]; 28 if(t2<min) 29 min=t2; 30 } 31 dp[i]=min;//到达第 i 个站最短时间 32 } 33 if(dp[n+1]<T1) 34 printf("What a pity rabbit!\n"); 35 else 36 printf("Good job,rabbit!\n"); 37 } 38 return 0; 39 }
标签:理解 结束 lin amp http show mission 自己 include
原文地址:http://www.cnblogs.com/l9987/p/6915928.html