fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main(int argc, const char * argv[]) {
  7.  
  8. int a,b;
  9. cin>>a>>b;
  10. int sp,sk;
  11.  
  12.  
  13. while(cin>>sp>>sk){
  14.  
  15. int iloscpodzielen=0;
  16.  
  17. for(int i=sp;i<=sk;i++){
  18.  
  19. if(i%a==0 || i%b==0){
  20.  
  21. iloscpodzielen++;
  22.  
  23. }
  24.  
  25.  
  26. }
  27.  
  28. cout<<iloscpodzielen<<endl;
  29.  
  30. }
  31.  
  32.  
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 4452KB
stdin
3 5
1 2
1 3
3 5
1 100
stdout
0
1
2
47