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

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