title: Dice Throw Problem 1
signature: fun diceThrowProblem1(f: Int, d: Int, s: Int): Long {
source_py: def dice_throw_problem_1(f, d, s):
      mem = [[0 for i in range((s + 1))] for j in range((d + 1))]
      mem[0][0] = 1
      for i in range(1, (d + 1)):
          for j in range(1, (s + 1)):
              mem[i][j] = (mem[i][(j - 1)] + mem[(i - 1)][(j - 1)])
              if (((j - f) - 1) >= 0):
                  mem[i][j] -= mem[(i - 1)][((j - f) - 1)]
      return mem[d][s]
source_cpp: long dice_throw_problem_1(int f, int d, int s) {
    long mem [ d + 1 ] [ s + 1 ];
    memset ( mem, 0, sizeof mem );
    mem [ 0 ] [ 0 ] = 1;
    for ( int i = 1;
    i <= d;
    i ++ ) {
      for ( int j = i;
      j <= s;
      j ++ ) {
        mem [ i ] [ j ] = mem [ i ] [ j - 1 ] + mem [ i - 1 ] [ j - 1 ];
        if ( j - f - 1 >= 0 ) mem [ i ] [ j ] -= mem [ i - 1 ] [ j - f - 1 ];
      }
    }
    return mem [ d ] [ s ];
  }
question_info.test_list: [{"idx": 0, "outputs": 35960, "inputs": {"f": 57, "d": 5, "s": 33}}, {"idx": 1, "outputs": 0, "inputs": {"f": 58, "d": 45, "s": 4}}, {"idx": 2, "outputs": 0, "inputs": {"f": 38, "d": 89, "s": 9}}, {"idx": 3, "outputs": 0, "inputs": {"f": 5, "d": 39, "s": 30}}, {"idx": 4, "outputs": 0, "inputs": {"f": 91, "d": 90, "s": 47}}, {"idx": 5, "outputs": 0, "inputs": {"f": 76, "d": 56, "s": 46}}, {"idx": 6, "outputs": 247959266474052, "inputs": {"f": 97, "d": 26, "s": 52}}, {"idx": 7, "outputs": 1, "inputs": {"f": 97, "d": 90, "s": 90}}, {"idx": 8, "outputs": 25, "inputs": {"f": 99, "d": 2, "s": 26}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Long, expected:Long):Boolean{
    return actual.equals(expected)
  }
  fun driver(f: Int, d: Int, s: Int, expected:Long):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(f, d, s), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(57, 5, 33, 35960)
      println("TEST-0...${result}")
      
      result = driver(58, 45, 4, 0)
      println("TEST-1...${result}")
      
      result = driver(38, 89, 9, 0)
      println("TEST-2...${result}")
      
      result = driver(5, 39, 30, 0)
      println("TEST-3...${result}")
      
      result = driver(91, 90, 47, 0)
      println("TEST-4...${result}")
      
      result = driver(76, 56, 46, 0)
      println("TEST-5...${result}")
      
      result = driver(97, 26, 52, 247959266474052)
      println("TEST-6...${result}")
      
      result = driver(97, 90, 90, 1)
      println("TEST-7...${result}")
      
      result = driver(99, 2, 26, 25)
      println("TEST-8...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: diceThrowProblem1
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn