title: Maximum Number Segments Lengths B C
signature: fun maximumNumberSegmentsLengthsBC(n: Int, a: Int, b: Int, c: Int): Int {
source_py: def maximum_number_segments_lengths_b_c(n, a, b, c):
      dp = ([(- 1)] * (n + 10))
      dp[0] = 0
      for i in range(0, n):
          if (dp[i] != (- 1)):
              if ((i + a) <= n):
                  dp[(i + a)] = max((dp[i] + 1), dp[(i + a)])
              if ((i + b) <= n):
                  dp[(i + b)] = max((dp[i] + 1), dp[(i + b)])
              if ((i + c) <= n):
                  dp[(i + c)] = max((dp[i] + 1), dp[(i + c)])
      return dp[n]
source_cpp: int maximum_number_segments_lengths_b_c(int n, int a, int b, int c) {
    int dp [ n + 1 ];
    memset ( dp, - 1, sizeof ( dp ) );
    dp [ 0 ] = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( dp [ i ] != - 1 ) {
        if ( i + a <= n ) dp [ i + a ] = max ( dp [ i ] + 1, dp [ i + a ] );
        if ( i + b <= n ) dp [ i + b ] = max ( dp [ i ] + 1, dp [ i + b ] );
        if ( i + c <= n ) dp [ i + c ] = max ( dp [ i ] + 1, dp [ i + c ] );
      }
    }
    return dp [ n ];
  }
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"n": 23, "a": 16, "b": 23, "c": 18}}, {"idx": 1, "outputs": -1, "inputs": {"n": 62, "a": 76, "b": 81, "c": 97}}, {"idx": 2, "outputs": 32, "inputs": {"n": 32, "a": 46, "b": 1, "c": 78}}, {"idx": 3, "outputs": -1, "inputs": {"n": 82, "a": 48, "b": 72, "c": 58}}, {"idx": 4, "outputs": -1, "inputs": {"n": 94, "a": 99, "b": 62, "c": 38}}, {"idx": 5, "outputs": -1, "inputs": {"n": 44, "a": 21, "b": 46, "c": 60}}, {"idx": 6, "outputs": 2, "inputs": {"n": 4, "a": 57, "b": 2, "c": 77}}, {"idx": 7, "outputs": 7, "inputs": {"n": 53, "a": 23, "b": 80, "c": 5}}, {"idx": 8, "outputs": -1, "inputs": {"n": 9, "a": 55, "b": 26, "c": 85}}, {"idx": 9, "outputs": -1, "inputs": {"n": 23, "a": 15, "b": 73, "c": 42}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, a: Int, b: Int, c: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n, a, b, c), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(23, 16, 23, 18, 1)
      println("TEST-0...${result}")
      
      result = driver(62, 76, 81, 97, -1)
      println("TEST-1...${result}")
      
      result = driver(32, 46, 1, 78, 32)
      println("TEST-2...${result}")
      
      result = driver(82, 48, 72, 58, -1)
      println("TEST-3...${result}")
      
      result = driver(94, 99, 62, 38, -1)
      println("TEST-4...${result}")
      
      result = driver(44, 21, 46, 60, -1)
      println("TEST-5...${result}")
      
      result = driver(4, 57, 2, 77, 2)
      println("TEST-6...${result}")
      
      result = driver(53, 23, 80, 5, 7)
      println("TEST-7...${result}")
      
      result = driver(9, 55, 26, 85, -1)
      println("TEST-8...${result}")
      
      result = driver(23, 15, 73, 42, -1)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: maximumNumberSegmentsLengthsBC
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn