Advertisement
niromru

Untitled

Nov 6th, 2021
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, d, t;
  8.     int k = 1;
  9.     int cur = 0;
  10.     cin >> n >> d >> t;
  11.     for (int i = 0; i < n; i++) {
  12.         int x, y;
  13.         cin >> x >> y;
  14.         while (cur < x) {
  15.             cur += 20;
  16.             k += 1;
  17.         }
  18.         if (cur < y && cur > x) {
  19.             cur = x;
  20.         }
  21.     }
  22.     while (cur < t) {
  23.         cur += 20;
  24.         k += 1;
  25.     }
  26.     cout << k << endl;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement