fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define ld long double
  4. #define fi first
  5. #define se second
  6. #define pii pair<int, int>
  7. #define all(x) (x).begin(), (x).end()
  8. using namespace std;
  9.  
  10. const int M = 1e6;
  11.  
  12. int main()
  13. {
  14. ios_base::sync_with_stdio(false);
  15. cin.tie(NULL);
  16.  
  17. int t; cin >> t;
  18. while (t--)
  19. {
  20. ll n; cin >> n;
  21. int res = 0,dd = 0;
  22. for (ll l = 1; l <= n;)
  23. {
  24. ll k = n/l;
  25. ll r = n/k;
  26. res = (res + (r-l+1)*k)%M;
  27. l = r + 1;
  28. dd++;
  29. }
  30. cout << dd << '\n';
  31. }
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 1.36s 5316KB
stdin
30
1000000000000
stdout
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999
1999999