Start: Jun, 28, 2019 13:00:00
2019年度暑期短学期第四天-助教场
End: Jun, 30, 2019 23:59:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 4ms
Memory: 1756kB
Author: 2018212212059
In contest: 1289

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <deque>
#define clr(a,b) memset(a,b,sizeof(a))
#define ll long long

using namespace std;

const int maxn=1e4+10;
int t;
int a,ta,b,tb;
int start;
string s;

int main()
{
	cin>>t;
	while(t--)
	{
		cin>>a>>ta>>b>>tb;
		cin>>s;
		start=(((int)s[0]-48)*10+(int)s[1]-48)*60+(int)(s[3]-48)*10+(int)s[4]-48;
		int down=start-tb,up=start+ta,ans=0;
		for(int i=300;i<=23*60+59;i+=b)
		{
			if(i>down&&i<up)ans++;//==的时候刚好在a||b相遇 
		}
		cout<<ans<<endl;
	}
}