Result: Accepted
Time: 9ms
Memory: 1712kB
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
int Myround(double a)
{
return a+0.5;
}
int main(void)
{
int T;
double d,w,c1,c2;
scanf("%d",&T);
while(T--)
{
c1=c2=0;
d=w=0;
scanf("%lf%lf",&d,&w);
d=Myround(d);
if(d<=3)
{
c1=11;
c2=11;
}
else if(d>3&&d<=10)
{
c1=11+(d-3)*2;
c2=11+(d-3)*2.5;
}
else if(d>10)
{
c1=11+2*7+3*(d-10);
c2=11+2.5*7+(d-10)*3.75;
}
if(w!=0)
{
c1+=w/5.0*2;
c2+=w/4.0*2.5;
}
printf("%d\n",Myround(c2)-Myround(c1));
}
return 0;
}