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