http://acm.hdu.edu.cn/showproblem.php?pid=2059
#include<iostream>
using namespace std;
struct Node
{
    
double tim;
    
double ls;
}
;
int main()
{
    
double S;
    
while(cin>>S)
    
{
        
int n,i,j;
        
double L,time,rv,tortoiseC,tortoiseQ,pos[103];
        Node dp[
103],temp;
        
double d,d1,d2,t1,t2;
        cin
>>n>>L>>time;
        cin
>>rv>>tortoiseQ>>tortoiseC;
        
for(i=1;i<=n;i++)
            cin
>>pos[i];
        
if(tortoiseQ<=tortoiseC)//骑车不如蹬车
        {
            
if(S/tortoiseC>S/rv)
                cout
<<"Good job,rabbit!"<<endl;
            
else
                cout
<<"What a pity rabbit!"<<endl;
            
continue;
        }

        dp[
0].tim=0;
        dp[
0].ls=L;
        pos[
0]=0;//一定要赋初值,否则其默认初值为负数,因为是double类型
        pos[n+1]=S;
        
for(i=1;i<=n+1;i++)
        
{
            dp[i].tim
=100000000;
            dp[i].ls
=0;
            
for(j=0;j<i;j++)//从出发点开始到i站之前选择一个最优的
            {
                d
=pos[i]-pos[j];
                
if(dp[j].ls>=d)//无需充电
                {
                    temp.tim
=dp[j].tim+d/tortoiseQ;
                    temp.ls
=dp[j].ls-d;
                }

                
else
                
{
                    t1
=dp[j].tim+dp[j].ls/tortoiseQ+(d-dp[j].ls)/tortoiseC;
                    d1
=0;
                    
if(L>=d)//充电够用情况
                    {
                        t2
=dp[j].tim+time+d/tortoiseQ;
                        d2
=L-d;
                    }

                    
else//充电不够用情况
                    {
                        t2
=dp[j].tim+time+L/tortoiseQ+(d-L)/tortoiseC;
                        d2
=0;
                    }


                    
if(t1<t2)//选择时间最少的
                    {
                        temp.tim
=t1;
                        temp.ls
=d1;
                    }

                    
else
                    
{
                        temp.tim
=t2;
                        temp.ls
=d2;
                    }

                }

                
if(temp.tim < dp[i].tim)
                
{
                    dp[i].tim
=temp.tim;
                    dp[i].ls
=temp.ls;
                }

            }
//for(j=0;j<i;j++)
        }
//for(i=1;i<=n+1;i++)
        if(dp[n+1].tim>S/rv)
            cout
<<"Good job,rabbit!"<<endl;
        
else
            cout
<<"What a pity rabbit!"<<endl;
    }

    
return 0;
}