fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8.  
  9. int n;
  10. cin>>n;
  11. while(t--)
  12. {
  13. int y;
  14. cin>>y;
  15. int c[1000001];
  16. int g[1000001]={0};
  17. for(int i=0;i<=n;i++)
  18. c[i]={0};
  19. for(int i=1;i<=n;i++)
  20. {
  21. for(int j=i;j<=n;j+=i)
  22. c[j]++;
  23. }
  24. for(int i=1;i<=n;i++)
  25. g[c[i]]++;
  26. for(int i=1;i<=n;i++)
  27. g[i]+=g[i-1];
  28. cout<<g[c[y]-1];
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0s 6992KB
stdin
2 8
3 4
stdout
15