title: Maximum Number Segments Lengths B C
signature: maximum_number_segments_lengths_b_c <- function(n, a, b, c) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, a, b, c, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n, a, b, c), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          23L, 16L, 23L, 18L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          62L, 76L, 81L, 97L, 
          -1L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          32L, 46L, 1L, 78L, 
          32L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          82L, 48L, 72L, 58L, 
          -1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          94L, 99L, 62L, 38L, 
          -1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          44L, 21L, 46L, 60L, 
          -1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          4L, 57L, 2L, 77L, 
          2L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          53L, 23L, 80L, 5L, 
          7L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          9L, 55L, 26L, 85L, 
          -1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          23L, 15L, 73L, 42L, 
          -1L
      )))
  
  }
  
  main()
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 ];
  }