fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. ll s=0,n;
  5. void solve(ll l, ll r) {
  6. ++s;
  7. if (n / l == n / r) { /* solve stuff here */ }
  8. else { ll mid = (l + r) / 2; solve(l, mid); solve(mid+1, r); }
  9. }
  10. int main() {
  11. cin>>n;
  12. ll C=sqrt(n)*2;
  13. solve(1,n);
  14. cout<<s<<endl;
  15. cout<<4*C<<endl;
  16. return 0;
  17. }
Success #stdin #stdout 0.06s 4500KB
stdin
123456789000
stdout
2982397
2810912