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: 2018212212261
In contest: 1277

#include<stdio.h>
#include<math.h>
int main(){
	int T,a,ta,b,tb,s,m,t,l,i;
	char c;
	scanf("%d",&T);
	while(T>0){
		l=0;
	scanf("%d%d",&a,&ta);
	scanf("%d%d",&b,&tb);
	scanf("%d%c%d",&s,&c,&m);
	t=s*60+m-300;
	
	for(i=0;i*b<1140;i++)
		if((i*b+tb)>t&&i*b<(t+ta))
			l++;
	printf("%d\n",l);
	
	T--;
	}
return 0;
}