标签:
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2059
#include<iostream> #include<cstring> #include<cmath> #include<string> #include<algorithm> using namespace std; int main(){ ios::sync_with_stdio( false ); int n; double l, c, t, vr, vt1, vt2, dis[105], dp[105], mint; while( cin >> l >> n >> c >> t >> vr >> vt1 >> vt2 ){ for( int i = 1; i <= n; i++ ) cin >> dis[i]; dis[0] = 0; dis[n + 1] = l; dp[0] = -t; for( int i = 1; i <= n + 1; i++ ){ mint = 0x3f3f3f3f; for( int j = 0; j < i; j++ ){ if( dis[i] - dis[j] <= c ) dp[i] = dp[j] + t + ( dis[i] - dis[j] ) / vt1; else dp[i] = dp[j] + t + c / vt1 + ( dis[i] - dis[j] - c ) / vt2; mint = min( mint, dp[i] ); } dp[i] = mint; } if( dp[ n + 1 ] <= l / vr ) cout << "What a pity rabbit!\n"; else cout << "Good job,rabbit!\n"; } return 0; }
标签:
原文地址:http://www.cnblogs.com/hollowstory/p/5454926.html