title: Minimum Perimeter N Blocks
signature: pub fn minimum_perimeter_n_blocks(n: i32) -> f64 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: f64, expected: f64)->bool{
  return (actual - expected).abs() < 1e-09
  }
  pub fn driver(n: i32, expected: f64)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        45, 
        28.832815729997478
      ));
      
      println!("TEST-1...{}", driver(
        80, 
        37.77708763999664
      ));
      
      println!("TEST-2...{}", driver(
        54, 
        29.393876913398138
      ));
      
      println!("TEST-3...{}", driver(
        48, 
        29.712812921102035
      ));
      
      println!("TEST-4...{}", driver(
        83, 
        36.4417343165772
      ));
      
      println!("TEST-5...{}", driver(
        68, 
        32.984845004941285
      ));
      
      println!("TEST-6...{}", driver(
        32, 
        24.62741699796952
      ));
      
      println!("TEST-7...{}", driver(
        20, 
        19.88854381999832
      ));
      
      println!("TEST-8...{}", driver(
        68, 
        32.984845004941285
      ));
      
      println!("TEST-9...{}", 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;
    }
  }