title: Minimum Perimeter N Blocks
signature: minimumPerimeterNBlocks :: Integer -> Double
  minimumPerimeterNBlocks n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Double -> Double -> Bool
  validateSolution actual expected = do
      (abs (actual-expected)) < 1e-09
  
  driver :: Integer -> Double -> String
  driver n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      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) )
  
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;
    }
  }