标签:
1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #define INF 0xfffffff 5 using namespace std; 6 double dp[111]; 7 int a[111]; 8 int main() 9 { 10 int l; 11 while(scanf("%d",&l)!=EOF) 12 { 13 int n,c,t,vr,v1,v2;cin>>n>>c>>t>>vr>>v1>>v2; 14 for(int i = 1;i <= n;i++) 15 scanf("%d",&a[i]); 16 a[0]=0;a[n+1]=l; 17 dp[0]=0; 18 for(int i = 1;i <= n+1;i++) 19 { 20 double ans = INF; 21 for(int j = 0;j < i;j++) 22 { 23 int Len = a[i]-a[j]; 24 double Time = Len>c?1.0*c/v1+(Len-c+0.0)/v2:1.0*Len/v1; 25 Time+=dp[j]; 26 if(j) 27 Time+=t; 28 ans = min(ans,Time); 29 } 30 dp[i]=ans; 31 } 32 if(1.0*l/vr>dp[n+1]) 33 printf("What a pity rabbit!\n"); 34 else 35 printf("Good job,rabbit!\n"); 36 } 37 return 0; 38 }
标签:
原文地址:http://www.cnblogs.com/llal/p/5751016.html