Facebook
From Lam, 1 Month ago, written in C++.
Embed
Download Paste or View Raw
Hits: 110
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. long long a, b, c, d,t=0;
  6.  
  7. int main() {
  8.     freopen("countnum.inp","r",stdin);
  9.     freopen("countnum.out","w",stdout);
  10.    
  11.     cin >> a >> b >> c >> d;
  12.     for (long long i = a; i <= b; i++) {
  13.         if (i % c != 0 && i % d != 0) {
  14.             t++;
  15.         }
  16.     }
  17.  
  18.     cout << t;
  19.  
  20.     return 0;
  21. }