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

#include <bits/stdc++.h>

using namespace std;

int a, Ta, b, Tb;
int h, m;

int main() {
    int t;
    cin >> t;
    while (t--) {
        scanf("%d %d", &a, &Ta);
        scanf("%d %d", &b, &Tb);
        scanf("%d:%d", &h, &m);
        int Time = (h - 5) * 60 + m;
        int ans = 0;
        for (int i = 0; i < 1140; i += b) {
            if (i < Time + Ta && i > Time - Tb) {
                ++ans;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}