fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. double n = in.nextDouble();
  11. double length = Math.floor(Math.sqrt(n));
  12. double width = Math.ceil(n / length);
  13. double k = 2 * n + length + width;
  14. System.out.print((int)(k));
  15. }
  16. }
Success #stdin #stdout 0.07s 2184192KB
stdin
4
stdout
12