fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long n, k;
  7. long double length, width;
  8. cin >> n;
  9. length = floor(sqrt(n));
  10. width = ceil(n/length);
  11. k = 2*n + length + width;
  12. cout << k << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 16048KB
stdin
2
stdout
7