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
Get:
#include<cstdio>
#include<math.h>
#include<cstring>
#include<climits>
#include<string>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define rep(i,j,k)for(i=j;i<k;i++)
#define per(i,j,k)for(i=j;i>k;i--)
#define MS(x,y)memset(x,y,sizeof(x))
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll long long
#define abs(x) (x>0?x:-x)
const int INF=0x7ffffff;
const ll MAX=1e18;
const int M=1e5+10;
double ans1,ans2,d,t;
void work()
{
if(d>10){
ans1=7*2.5+(d-10)*3.75+t/4.0*2.5;
ans2=7*2.0+(d-10)*3.0+t/5.0*2.0;
}
else if(d>3){
ans1=(d-3)*2.5+t/4.0*2.5;
ans2=(d-3)*2.0+t/5.0*2.0;
}
else {
ans1=t/4.0*2.5;
ans2=t/5.0*2.0;
}
ans1=(int)(ans1+0.5);
ans2=(int)(ans2+0.5);
}
int main()
{
int T;
scanf("%d",&T);
while(T--){
scanf("%lf%lf",&d,&t);
work();
printf("%d\n",(int)(ans1-ans2));
}
return 0;
}