title: Minimum Perimeter N Blocks
signature: minimum_perimeter_n_blocks <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      abs(actual - expected) < 1e-09
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          45L, 
          28.832815729997478
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          80L, 
          37.77708763999664
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          54L, 
          29.393876913398138
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          48L, 
          29.712812921102035
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          83L, 
          36.4417343165772
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          68L, 
          32.984845004941285
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          32L, 
          24.62741699796952
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          20L, 
          19.88854381999832
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          68L, 
          32.984845004941285
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          66L, 
          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;
    }
  }