Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Earn Points

med
30 min
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 2extD2 ext{D} integer array types where types[i] =[extcounti,extmarksi]= [ ext{count}_i, ext{marks}_i] indicates that there are $ ext{count}_i$ questions of the iextthi^{ ext{th}} type, and each question of that type awards $ ext{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≤extcounti,extmarksi≤501 \leq ext{count}_i, ext{marks}_i \leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Earn Points

med
30 min
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 2extD2 ext{D} integer array types where types[i] =[extcounti,extmarksi]= [ ext{count}_i, ext{marks}_i] indicates that there are $ ext{count}_i$ questions of the iextthi^{ ext{th}} type, and each question of that type awards $ ext{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≤extcounti,extmarksi≤501 \leq ext{count}_i, ext{marks}_i \leq 50