比赛 20151026 评测结果 AAAAAAAAAA
题目名称 摩托车游戏 最终得分 100
用户昵称 Steve 运行时间 0.032 s
代码语言 C++ 内存使用 0.30 MiB
提交时间 2015-10-26 21:20:14
显示代码纯文本
#include<cstdio>
#define maxn 1005
#define ll long long 
#define inf 1e19;
using namespace std;
ll s;
double t,dp[maxn];
double _findcost(ll x)// find the time from j to i which you take.
{
	if(x<=10)return x/100.0;
	if(x>10&&x<=20)return x/90.0;
	if(x>20&&x<=30)return x/80.0;
	if(x>30&&x<=40)return x/75.0;
	if(x>40)return x/70.0;
}
double _min(double x,double y)
{
	if(x<y)return x;
	return y;
}
int main()
{
	freopen("carz.in","r",stdin);
	freopen("carz.out","w",stdout);
	ll i,j;
	scanf("%I64d%lf",&s,&t);
	s=s/10;
	t=t/60.0;
	for(i=1;i<=s;i++)dp[i]=inf;
	for(i=1;i<=s;i++)
	 for(j=0;j<=i;j++)
		dp[i]=_min(dp[i],dp[j]+t+_findcost(10*(i-j)));
	//for(i=1;i<=s;i++)cout<<dp[i]<<endl;
    printf("%.2lf",dp[s]-t);
	return 0;
}