title: Dice Throw Problem
signature: class Solution {
  
      public Integer diceThrowProblem(Integer m, Integer n, Integer x) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer m, Integer n, Integer x, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(m, n, x,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(94, 4, 69, 50116);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(7, 12, 33, 77635844);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(20, 44, 24, 0);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(90, 94, 88, 0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(50, 58, 27, 0);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(32, 90, 29, 0);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(46, 25, 6, 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(43, 82, 70, 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(6, 83, 19, 0);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer m, Integer n, Integer x, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(m, n, x),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def dice_throw_problem(m, n, x):
      table = [([0] * (x + 1)) for i in range((n + 1))]
      for j in range(1, min((m + 1), (x + 1))):
          table[1][j] = 1
      for i in range(2, (n + 1)):
          for j in range(1, (x + 1)):
              for k in range(1, min((m + 1), j)):
                  table[i][j] += table[(i - 1)][(j - k)]
      return table[(- 1)][(- 1)]
source_cpp: int dice_throw_problem(int m, int n, int x) {
    int table [ n + 1 ] [ x + 1 ];
    memset ( table, 0, sizeof ( table ) );
    for ( int j = 1;
    j <= m && j <= x;
    j ++ ) table [ 1 ] [ j ] = 1;
    for ( int i = 2;
    i <= n;
    i ++ ) for ( int j = 1;
    j <= x;
    j ++ ) for ( int k = 1;
    k <= m && k < j;
    k ++ ) table [ i ] [ j ] += table [ i - 1 ] [ j - k ];
    return table [ n ] [ x ];
  }