title: Maximum Number Of Squares That Can Be Fit In A Right Angle Isosceles Triangle
signature: function maximum_number_of_squares_that_can_be_fit_in_a_right_angle_isosceles_triangle(b, m)
source_py: def maximum_number_of_squares_that_can_be_fit_in_a_right_angle_isosceles_triangle(b, m):
      return ((((b / m) - 1) * (b / m)) / 2)
source_cpp: int maximum_number_of_squares_that_can_be_fit_in_a_right_angle_isosceles_triangle(int b, int m) {
    return ( b / m - 1 ) * ( b / m ) / 2;
  }
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return math.abs(actual - expected) < 1e-09
  end
  
  function driver(b, m, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(b, m) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(40, 74, -0.1241782322863404)
      print(string.format("TEST-0...%s",result))
  
      result = driver(38, 35, 0.04653061224489791)
      print(string.format("TEST-1...%s",result))
  
      result = driver(47, 71, -0.11188256298353501)
      print(string.format("TEST-2...%s",result))
  
      result = driver(52, 29, 0.7110582639714625)
      print(string.format("TEST-3...%s",result))
  
      result = driver(21, 9, 1.5555555555555558)
      print(string.format("TEST-4...%s",result))
  
      result = driver(50, 33, 0.3902662993572084)
      print(string.format("TEST-5...%s",result))
  
      result = driver(8, 82, -0.04402141582391434)
      print(string.format("TEST-6...%s",result))
  
      result = driver(56, 80, -0.10500000000000001)
      print(string.format("TEST-7...%s",result))
  
      result = driver(93, 5, 163.68000000000004)
      print(string.format("TEST-8...%s",result))
  
      result = driver(21, 90, -0.08944444444444444)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": -0.1241782322863404, "inputs": {"b": 40, "m": 74}}, {"idx": 1, "outputs": 0.04653061224489791, "inputs": {"b": 38, "m": 35}}, {"idx": 2, "outputs": -0.11188256298353501, "inputs": {"b": 47, "m": 71}}, {"idx": 3, "outputs": 0.7110582639714625, "inputs": {"b": 52, "m": 29}}, {"idx": 4, "outputs": 1.5555555555555558, "inputs": {"b": 21, "m": 9}}, {"idx": 5, "outputs": 0.3902662993572084, "inputs": {"b": 50, "m": 33}}, {"idx": 6, "outputs": -0.04402141582391434, "inputs": {"b": 8, "m": 82}}, {"idx": 7, "outputs": -0.10500000000000001, "inputs": {"b": 56, "m": 80}}, {"idx": 8, "outputs": 163.68000000000004, "inputs": {"b": 93, "m": 5}}, {"idx": 9, "outputs": -0.08944444444444444, "inputs": {"b": 21, "m": 90}}]
question_info.extension: lua
question_info.entry_fn_name: maximum_number_of_squares_that_can_be_fit_in_a_right_angle_isosceles_triangle
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__