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: 6ms
Memory: 1712kB
Author: 2017212212237
In contest: 1289

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long ll;

const int maxn = 1e4+7;

char Time[10];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,Ta,b,Tb;
        int h,m;
        scanf("%d %d",&a,&Ta);
        scanf("%d %d",&b,&Tb);

        scanf("%s",Time);
        h = (Time[0] - '0' )* 10 + Time[1] - '0';
        m = (Time[3] - '0' )* 10 + Time[4] - '0';
        int tot = h * 60 + m;
        int st =  tot - Tb;
        int en = tot + Ta;
        //printf("%d %d\n",st,en);
        int ans = 0;
        for(int i=300;i<=23 * 60 + 59;i += b)
        {
            if(i > st && i < en) {
                ans++;
                //cout<<i<<endl;
            }
        }
        printf("%d\n",ans);
    }
}