Advertisement
Josif_tepe

Untitled

Feb 12th, 2024
1,380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. //#include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5. long long sleden_deliv_so_5(long long x) {
  6.     while(x % 5 != 0) {
  7.         x++;
  8.     }
  9.     return x;
  10. }
  11. long long prethoden_deliv_so_5(long long x) {
  12.     while(x % 5 != 0) {
  13.         x--;
  14.     }
  15.     return x;
  16. }
  17. int main() {
  18.     long long x, y;
  19.     cin >> x >> y;
  20.    
  21.     long long minimum = ceil(20.0 * x / 19.0);
  22.     long long maksimum = floor(10.0 * x / 9.0);
  23.    
  24.     if(maksimum > y) {
  25.         maksimum = y;
  26.     }
  27.    
  28.     if(minimum % 5 != 0){
  29.         minimum = sleden_deliv_so_5(minimum);
  30.     }
  31.     if(maksimum % 5 != 0) {
  32.         maksimum = prethoden_deliv_so_5(maksimum);
  33.     }
  34.    
  35.     if(minimum > maksimum) {
  36.         cout << 0 << endl;
  37.     }
  38.     else {
  39.         cout << (maksimum - minimum) / 5 + 1 << endl;
  40.     }
  41.    
  42.  
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement