Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Earn Points

Try to solve the Number of Ways to Earn Points problem.

Statement

There is an exam that contains n different types of questions. You are given an integer target and a 2D2 {D} integer array types where types[i] =[counti,marksi]= [ {count}_i, {marks}_i] indicates that there are counti{count}_i questions of the ithi^{ {th}} type, and each question of that type awards marksi{marks}_i points.

Return the total number of distinct ways to score exactly target points in the exam. Since the final answer may be very large, return it modulo 109+710^9 + 7.

Note: Two ways are considered different if they differ in the number of questions solved for at least one type.

Constraints:

  • 1≤1 \leq target ≤1000\leq 1000

  • n ==== types.length

  • 1≤1 \leq n ≤50\leq 50

  • types[i].length ==2== 2

  • 1≤counti,marksi≤501 \leq {count}_i, {marks}_i \leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Earn Points

Try to solve the Number of Ways to Earn Points problem.

Statement

There is an exam that contains n different types of questions. You are given an integer target and a 2D2 {D} integer array types where types[i] =[counti,marksi]= [ {count}_i, {marks}_i] indicates that there are counti{count}_i questions of the ithi^{ {th}} type, and each question of that type awards marksi{marks}_i points.

Return the total number of distinct ways to score exactly target points in the exam. Since the final answer may be very large, return it modulo 109+710^9 + 7.

Note: Two ways are considered different if they differ in the number of questions solved for at least one type.

Constraints:

  • 1≤1 \leq target ≤1000\leq 1000

  • n ==== types.length

  • 1≤1 \leq n ≤50\leq 50

  • types[i].length ==2== 2

  • 1≤counti,marksi≤501 \leq {count}_i, {marks}_i \leq 50