您的位置:首页 > 其它

zoj 3600 Taxi Fare

2012-04-15 10:09 337 查看
#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;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: