现在的位置: 首页 > 综合 > 正文

zoj 3600 Taxi Fare

2012年09月29日 ⁄ 综合 ⁄ 共 363字 ⁄ 字号 评论关闭
#include "iostream"
using namespace std;

int main()
{
	int testcase;
	double s1, s2, ans, d, t;
	cin >> testcase;
	while (testcase--)
	{
		cin >> d >> t;
		s1 = s2 = ans = 0;
		if (d <= 3)
		{
			s1 = 10 + 1 + 2*t/5;
			s2 = 11 + 2.5*t/4;
		}
		else if (d > 3 && d <= 10)
		{
			s1 = 10 + 1 + 2*t/5 + (d-3)*2;
			s2 = 11 + 2.5*t/4 + (d-3)*2.5;
		}
		else
		{
			s1 = 10+ 1 + 2*t/5 + 7*2 + (d-10)*3;
			s2 = 11 + 2.5*t/4 + 7*2.5 + (d-10)*3.75;
		}
		s1 = (int)(s1 + 0.5);
		s2 = (int)(s2 + 0.5);
		ans = s2 - s1;
		cout << ans << endl;
	}
}

抱歉!评论已关闭.