fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. long a,b,p,q;
  7. long d = 0;
  8. cin >> a >> b >> p >> q;
  9. for (int i = a; i <= b; i++)
  10. if (i % p == q )
  11. d = d + 1;
  12. cout << d;
  13. return 0;
  14. }
Time limit exceeded #stdin #stdout 5s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty