Start: May, 31, 2017 13:30:00
2017ACM通识课期末考试
End: May, 31, 2017 17:30:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 9ms
Memory: 1712kB
Author: 1772780065
In contest: 1090

#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;
}