title: Count Numbers Can Constructed Using Two Numbers
signature: class Solution {
  
      public Integer countNumbersCanConstructedUsingTwoNumbers(Integer n, Integer x, Integer y) {
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 x, Integer y, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, x, y,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, 16, 1);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(56, 95, 6, 9);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(30, 63, 1, 30);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(51, 89, 46, 1);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(21, 99, 38, 0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(69, 63, 50, 2);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(12, 69, 73, 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(44, 52, 9, 4);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(99, 65, 10, 13);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(46, 58, 37, 1);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer x, Integer y, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, x, y),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def count_numbers_can_constructed_using_two_numbers(n, x, y):
      arr = [False for i in range((n + 2))]
      if (x <= n):
          arr[x] = True
      if (y <= n):
          arr[y] = True
      result = 0
      for i in range(min(x, y), (n + 1)):
          if arr[i]:
              if ((i + x) <= n):
                  arr[(i + x)] = True
              if ((i + y) <= n):
                  arr[(i + y)] = True
              result = (result + 1)
      return result
source_cpp: int count_numbers_can_constructed_using_two_numbers(int n, int x, int y) {
    vector < bool > arr ( n + 1, false );
    if ( x <= n ) arr [ x ] = true;
    if ( y <= n ) arr [ y ] = true;
    int result = 0;
    for ( int i = min ( x, y );
    i <= n;
    i ++ ) {
      if ( arr [ i ] ) {
        if ( i + x <= n ) arr [ i + x ] = true;
        if ( i + y <= n ) arr [ i + y ] = true;
        result ++;
      }
    }
    return result;
  }