ZOJ 3600【Taxi Fare】模拟

Description

Last September, Hangzhou raised the taxi fares.

The original flag-down fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10km. The waiting fee was 2 yuan per five minutes. Passengers need to pay extra 1 yuan as the fuel surcharge.

According to new prices, the flag-down fare is 11 yuan, while passengers pay 2.5 yuan per kilometer after the first 3 kilometers, and 3.75 yuan per kilometer after 10km. The waiting fee is 2.5 yuan per four minutes.

The actual fare is rounded to the nearest yuan, and halfway cases are rounded up. How much more money does it cost to take a taxi if the distance is d kilometers and the waiting time is t minutes.

Input

There are multiple test cases. The first line of input is an integer T ≈ 10000 indicating the number of test cases.

Each test case contains two integers 1 ≤ d ≤ 1000 and 0 ≤ t ≤ 300.

Output

For each test case, output the answer as an integer.

Sample Input

4
2 0
5 2
7 3
11 4

Sample Output

0
1
3
5

、、


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
       double d,w;
        scanf("%lf%lf",&d,&w);
        double sum1=0,sum2=0;
        //先计算起步价
        sum1+=10;
        sum2+=11;
        d=d-3;
        if(d>0&&d<=7)//大于3
        {
            sum1+=d*2;
            sum2+=d*2.5;
        }
        else if(d>7)
        {
            sum1+=7*2;
            sum2+=7*2.5;
            d-=7;
            sum1+=d*3;
            sum2+=d*3.75;

        }
         sum1+=w*0.4;
         sum2+=w*0.625;
         sum1+=1;
         int a,b;
         a=sum1;
         b=sum2;
         if((sum1-a)>=0.5)
            a=a+1;
         if((sum2-b)>=0.5)
            b=b+1;
        //四舍五入
         printf("%d\n",b-a);


    }
    return 0;
}


《HTT电脑秘书软件》是一个小巧实用的工具,通过它可以方便地打开您常用的程序、文档资料、以及网站链接等。《HTT电脑秘书软件》 的最大好处,莫过于它的易用性。当然,它还有许多特点: 1、极其简单的打开/隐藏方式:鼠标移向屏幕右下角,《HTT电脑秘书软件》 主窗口马上打开;鼠标移向屏幕右边界下方,主窗口立即消失,移到右边界上方,主窗口立即显示。也可以通过单击右下角的本系统图标进行打开和隐藏。 2、允许对程序项进行分门别类,用户可建立任意树形目录结构,并提供两种目录显示方式。 3、可以对《HTT电脑秘书软件》中的任何程序文档等项目定义系统级热键,无论《HTT电脑秘书软件》是否在前台,均可捕获热键。 4、有自启动功能,每次进入Windows后,《HTT电脑秘书软件》 以小图标方式显示在任务条上的通知区中。 5、支持OLE拖放功能,您可将任意文件或IE/Netscape中的超链接拖入《HTT电脑秘书软件》中。 6、提供多种小巧实用的工具,如日程记事、HTT文档编辑器,HTT图片编辑器、Office文档编辑器等,并允许以插件方式加以扩充。 7、可以通过拖放方式,将你的系统中的所有文件添加到【文档库】节点(该节点对应本系统所在路径下的文件夹),将你系统的所有文件进行集中管理。 《HTT电脑秘书软件》 的插件编程接口: 如果你需要给本系统编写插件,请与我们公司联系。 E-mail: htt@huitetong.com WWW: http://www.huitetong.com Tel: 010-82896850 13801355031 作者:赵宝泽
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值