fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define io std::ios_base::sync_with_stdio(0);std::cin.tie(0);std::cout.tie(0);
  4. #define file(name) {freopen(name".INP","r",stdin);freopen(name".OUT","w",stdout);}
  5. int u[1000005],d[1000005],l,r;
  6. int main(){
  7. io;file("SODB");
  8. fill(u,u+1000005,0);fill(d,d+1000005,0);
  9. for(int i=1;i<=1000000;i++){
  10. for(int j=i;j<=1000000;j+=i){
  11. u[j]++;
  12. }
  13. }
  14. for(int i=1;i<=1000000;i++){
  15. d[i]=d[i-1];
  16. if(u[i]==4){d[i]++;}
  17. }
  18. int n;
  19. cin>>n;
  20. for(int i=1;i<=n;i++){
  21. cin>>l>>r;
  22. cout<<d[r]-d[l-1]<<"\n";
  23. }
  24. return 0;}
  25.  
Success #stdin #stdout 0.04s 11636KB
stdin
Standard input is empty
stdout
Standard output is empty