Start: Jul, 01, 2019 08:30:00
2019年度暑期短学期第四天
End: Jul, 01, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 3ms
Memory: 1120kB
Author: 2018212212017
In contest: 1277

#include<stdio.h>
int main()
{
	int T;
	scanf("%d",&T);
	while (T--)
	{
		int a,at,b,bt;
		scanf("%d %d",&a,&at);
		scanf("%d %d",&b,&bt);
		int x,y;
		scanf("%d:%d",&x,&y);
		int time;
		time=x*60+y;
		int end;
		end=time+at;
		int i,sum=0;
		for (i=0;300+b*i<1440;i++)
		{
			if (300+b*i>time-bt&&300+b*i<end)
			sum+=1;			

			
		}
		printf("%d\n",sum);
	}
	
}