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

#include<stdio.h>
int main(){
	int T,Ta,Tb,a,b,t1,t2,i,t;
	scanf("%d",&T);
	while(T--){
		int sum=0;
		scanf("%d%d%d%d",&a,&Ta,&b,&Tb);
		scanf("%d:%d",&t1,&t2);
		t=60*t1+t2-300;
		for(i=0;i*b<1140;i++)
			if(i*b+Tb>t&&i*b<t+Ta)
				sum++;
		printf("%d\n",sum);
	}
}