title: Minimum Perimeter N Blocks
signature: function minimumPerimeterNBlocks($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return abs($actual - $expected) < 1e-09;
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        45, 
        28.832815729997478));
      
      printf("TEST-1...%s\n",driver(
        80, 
        37.77708763999664));
      
      printf("TEST-2...%s\n",driver(
        54, 
        29.393876913398138));
      
      printf("TEST-3...%s\n",driver(
        48, 
        29.712812921102035));
      
      printf("TEST-4...%s\n",driver(
        83, 
        36.4417343165772));
      
      printf("TEST-5...%s\n",driver(
        68, 
        32.984845004941285));
      
      printf("TEST-6...%s\n",driver(
        32, 
        24.62741699796952));
      
      printf("TEST-7...%s\n",driver(
        20, 
        19.88854381999832));
      
      printf("TEST-8...%s\n",driver(
        68, 
        32.984845004941285));
      
      printf("TEST-9...%s\n",driver(
        66, 
        34.49615361854384));
      
  }
  
  main();
  ?>
source_py: def minimum_perimeter_n_blocks(n):
      l = math.sqrt(n)
      sq = (l * l)
      if (sq == n):
          return (l * 4)
      else:
          row = (n / l)
          perimeter = (2 * (l + row))
          if ((n % l) != 0):
              perimeter += 2
          return perimeter
source_cpp: int minimum_perimeter_n_blocks(int n) {
    int l = sqrt ( n );
    int sq = l * l;
    if ( sq == n ) return l * 4;
    else {
      long long int row = n / l;
      long long int perimeter = 2 * ( l + row );
      if ( n % l != 0 ) perimeter += 2;
      return perimeter;
    }
  }