标签:
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
Input
Output
Sample Input
Sample Output
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 5 using namespace std; 6 #define INF 0x3f3f3f3f 7 8 int main() 9 { 10 int n; 11 double L,VR,VT1,VT2,p[200],dp[200],C,T; 12 while(cin>>L>>n>>C>>T>>VR>>VT1>>VT2) 13 { 14 memset(dp,0,sizeof(dp)); 15 for(int i=1;i<=n;i++) cin>>p[i]; 16 17 p[0]=0; 18 p[n+1]=L; 19 20 for(int i=1;i<=n+1;i++) 21 { 22 dp[i]=INF; 23 for(int j=0;j<i;j++) 24 { 25 double len=p[i]-p[j],time; 26 if(len>=C) time=(len-C)/VT2+C/VT1; 27 else time=len/VT1; 28 time+=dp[j]; 29 if(j) time+=T; 30 dp[i]=min(dp[i],time); 31 } 32 } 33 double time2=L/VR; 34 if(time2<dp[n+1]) cout<<"Good job,rabbit!"<<endl; 35 else cout<<"What a pity rabbit!"<<endl; 36 } 37 }
标签:
原文地址:http://www.cnblogs.com/wsaaaaa/p/4295415.html