title: Dynamic Programming Set 36 Cut A Rope To Maximize Product 1
signature: pub fn dynamic_programming_set_36_cut_a_rope_to_maximize_product_1(n: i32) -> i64 {
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: i64, expected: i64)->bool{
  return actual==expected
  }
  pub fn driver(n: i32, expected: i64)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        62, 
        6973568802
      ));
      
      println!("TEST-1...{}", driver(
        53, 
        258280326
      ));
      
      println!("TEST-2...{}", driver(
        8, 
        18
      ));
      
      println!("TEST-3...{}", driver(
        6, 
        9
      ));
      
      println!("TEST-4...{}", driver(
        35, 
        354294
      ));
      
      println!("TEST-5...{}", driver(
        35, 
        354294
      ));
      
      println!("TEST-6...{}", driver(
        46, 
        19131876
      ));
      
      println!("TEST-7...{}", driver(
        74, 
        564859072962
      ));
      
      println!("TEST-8...{}", driver(
        69, 
        94143178827
      ));
      
      println!("TEST-9...{}", driver(
        3, 
        2
      ));
      
  }
source_py: def dynamic_programming_set_36_cut_a_rope_to_maximize_product_1(n):
      if ((n == 2) or (n == 3)):
          return (n - 1)
      res = 1
      while (n > 4):
          n -= 3
          res *= 3
      return (n * res)
source_cpp: int dynamic_programming_set_36_cut_a_rope_to_maximize_product_1(int n) {
    if ( n == 2 || n == 3 ) return ( n - 1 );
    int res = 1;
    while ( n > 4 ) {
      n -= 3;
      res *= 3;
    }
    return ( n * res );
  }