Advertisement
Guest User

a.cpp

a guest
Jul 18th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <algorithm>
  5. #include <functional>
  6. #include <vector>
  7. #include <string>
  8. #include <queue>
  9. #include <deque>
  10. #include <cassert>
  11. #include <set>
  12. #include <map>
  13.  
  14. typedef long long ll;
  15.  
  16. int main() {
  17.     // std::ios_base::sync_with_stdio(false);
  18.     // std::cin.tie(0); std::cout.tie(0); std::cerr.tie(0);
  19.    
  20.     int d1, t1, d2, t2;
  21.     scanf("%d %d %d %d", &d1, &t1, &d2, &t2);
  22.    
  23.     int h, m;
  24.     scanf("%d:%d", &h, &m);
  25.     m += h * 60;
  26.    
  27.     int s = 5 * 60, f = 23 * 60 + 59;
  28.    
  29.     int count = 0;
  30.     for (int begin = s; begin <= f; begin += d2) {
  31.         const int end = begin + t2;
  32.         // (begin, end) с (m, m+t1)
  33.         if (end <= m || begin >= m+t1) {
  34.             continue;
  35.         }
  36.         ++count;
  37.     }
  38.     printf("%d", count);
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement