hdu 2059 龜兔賽跑 (dp)
/*
把起點和終點比作加油站,那總共有n+2個加油站了,
每次都求出從第0個到第j個加油站(j
# include
# include
# define INF 999999999;
using namespace std;
int main()
{
int L,n,c,t,i,j;
double min1,tmp;
int vr,vt1,vt2;
int path[100010];
double dp[100010];
while(~scanf("%d%d%d%d",&L,&n,&c,&t))
{
scanf("%d%d%d",&vr,&vt1,&vt2);
path[0]=0;
for(i=1; i<=n; i++)
scanf("%d",&path[i]);
path[n+1]=L;
dp[0]=0;
for(i=1; i<=n+1; i++)
{
dp[i]=INF;
for(j=0; j=ll)
tmp=ll*1.0/vt1;
else
tmp=c*1.0/vt1+(ll-c)*1.0/vt2;
if(j!=0)
tmp+=t;
if(dp[i]>dp[j]+tmp)
dp[i]=dp[j]+tmp;
}
}
if(dp[n+1]>L*1.0/vr)
printf("Good job,rabbit!\n");
else
printf("What a pity rabbit!\n");
}
return 0;
}