#include<iostream>
using namespace std;
![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
struct Node
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif)
{
double time;
double len;
};
![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
int main()
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif)
{
int n;
double L;
double c,T;
double vr,vt1,vt2;
while(cin>>L)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
cin>>n>>c>>T;
cin>>vr>>vt1>>vt2;
int i,j;
double a[105];
Node dp[105];
for(i = 1;i <= n;i++)
cin>>a[i];
double sum = L/vr;
dp[0].time = 0.0;
dp[0].len = c;
a[0] = 0.0;
a[n+1] = L;
double dd;
double t,t1,t2;
double d,d1,d2;
if(vt1<=vt2)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if( L/vt2 > sum)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
cout<<"Good job,rabbit!"<<endl;
}
else
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
cout<<"What a pity rabbit!"<<endl;
}
continue;
}
for(i = 1;i <= n+1;i++)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if(a[i] <= c)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
dp[i].time = a[i]/vt1;
dp[i].len = c - a[i];
}
else
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
dp[i].time = c/vt1 + (a[i] - c)/vt2;
dp[i].len = 0;
}
![](http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif)
for(j = 1;j < i;j++)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
dd = a[i] - a[j];
if(dd <= dp[j].len)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
t = dd/vt1;
d = dp[j].len -dd;
}
else
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
t1 = dp[j].len/vt1 + (dd-dp[j].len)/vt2 ;
d1 = 0;
if( c >= dd)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
t2 = dd/vt1 + T;
d2 = c - dd ;
}
else
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
t2 = c/vt1 + (dd - c)/vt2 +T;
d2 = 0;
}
![](http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif)
if(t1 < t2)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
t = t1 ;
d = d1;
}
else
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
t = t2;
d = d2;
}
}
if(dp[i].time > t + dp[j].time)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
dp[i].time = t + dp[j].time;
dp[i].len = d;
}
}//for(j = 1;j < i;j++)
}
if(dp[n+1].time > sum)
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
cout<<"Good job,rabbit!"<<endl;
}
else
![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
cout<<"What a pity rabbit!"<<endl;
}
}
return 0;
}