fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define file(name) if (fopen(name".INP", "r")){freopen(name".INP", "r", stdin); freopen(name".OUT", "w", stdout);}
  5.  
  6. const int maxn = 1e6 + 7;
  7.  
  8. int cnt[maxn];
  9.  
  10. void solution(){
  11.  
  12. cnt[1] = 1;
  13. for (int i = 2; i <= maxn; i++) cnt[i] = 2;
  14. for (int i = 2; i * i < maxn; i++){
  15. cnt[i*i]--;
  16. for (int j = i; i*j <= maxn; j++) cnt[i*j] += 2;
  17. }
  18. int TestCase; cin >> TestCase;
  19. while (TestCase --> 0){
  20. int x; cin >> x;
  21. cout << cnt[x] << "\n";
  22. }
  23.  
  24. }
  25.  
  26. signed main(){
  27. ios_base::sync_with_stdio(0);
  28. cin.tie(0); cout.tie(0);
  29.  
  30. file("TEST");
  31.  
  32. solution();
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.02s 7516KB
stdin
Standard input is empty
stdout
Standard output is empty