title: Maximum Number Segments Lengths B C
signature: class Solution {
  
      public Integer maximumNumberSegmentsLengthsBC(Integer n, Integer a, Integer b, Integer c) {
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.extension: java
question_info.entry_fn_name: maximumNumberSegmentsLengthsBC
question_info.entry_cls_name: Solution
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.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer a, Integer b, Integer c, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, a, b, c,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(23, 16, 23, 18, 1);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(62, 76, 81, 97, -1);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(32, 46, 1, 78, 32);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(82, 48, 72, 58, -1);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(94, 99, 62, 38, -1);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(44, 21, 46, 60, -1);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(4, 57, 2, 77, 2);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(53, 23, 80, 5, 7);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(9, 55, 26, 85, -1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(23, 15, 73, 42, -1);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer a, Integer b, Integer c, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, a, b, c),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__