记录编号 199767 评测结果 AAAAAAAAAA
题目名称 摩托车游戏 最终得分 100
用户昵称 Gravatarzhengtn03 是否通过 通过
代码语言 C++ 运行时间 0.003 s
提交时间 2015-10-27 15:04:56 内存使用 0.39 MiB
显示代码纯文本
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
using namespace std;

double a[10010];

int main()
{
	freopen("carz.in","r",stdin);
	freopen("carz.out","w",stdout);
	double S, T;
	int S1;
	scanf("%d%lf", &S1, &T);
	T /= 60;
	S = (double)S1;
	double ans = S / 70.0;
	if (S1 <= 10)
	{
		ans = S / 100.0;
	}
	else if (S1 <= 20)
	{
		ans = S / 90.0;
	}
	else if (S1 <= 30)
	{
		ans = S / 80.0;
	}
	else if (S1 <= 40)
	{
		ans = S / 75.0;
	}
	a[10] = T + 10.0 / 100.0;
	a[20] = a[10] + T + 10.0 / 100.0;
	a[20] = min(a[20], T + 20.0 / 90.0);
	a[30] = a[10] + a[20];
	a[30] = min(a[30], T + 30.0 / 80.0);
	a[40] = a[30] + a[10];
	a[40] = min(a[40], a[20] + a[20]);
	a[40] = min(a[40], T + 40.0 / 75.0);
	for (int i = 50; i <= S1; i += 10)
	{
		a[i] = 2000000000;
		a[i] = min(a[i], a[i - 10] + T + 10.0 / 100.0);
		a[i] = min(a[i], a[i - 20] + T + 20.0 / 90.0);
		a[i] = min(a[i], a[i - 30] + T + 30.0 / 80.0);
		a[i] = min(a[i], a[i - 40] + T + 40.0 / 75.0);
	}
	if (S1 >= 20) ans = min(ans, a[S1 - 10] + 10.0 / 100.0);
	if (S1 >= 30) ans = min(ans, a[S1 - 20] + 20.0 / 90.0);
	if (S1 >= 40) ans = min(ans, a[S1 - 30] + 30.0 / 80.0);
	if (S1 >= 50) ans = min(ans, a[S1 - 40] + 40.0 / 75.0);
	//printf("%.2lf %.2lf\n", a[20] ,20.0 / 90.0);
	/*for (int i = 10; i <= S1; i += 10)
	{
	printf("%.2lf\n", a[i]);
	}*/
	printf("%.2lf\n", ans);
	return 0;
}