title: Dice Throw Problem
signature: class Solution {
  
      public int DiceThrowProblem(int m, int n, int x) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(int m, int n, int x, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(m, n, x); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  94, 4, 69, 
                  50116
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  7, 12, 33, 
                  77635844
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  20, 44, 24, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  90, 94, 88, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  50, 58, 27, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  32, 90, 29, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  46, 25, 6, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  43, 82, 70, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  6, 83, 19, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );
          }
      }
  }
  
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 ];
  }