budget to spend. A notebook costs notebook_price and a marker costs marker_price. You may buy any number of notebooks and markers, including none, as long as the total does not exceed the budget; you do not have to spend all of it.
A purchase is described by two numbers: how many notebooks and how many markers you take. Return the number of different purchases you can afford.budget=12, notebook_price=5, marker_price=3 → 9
With no notebooks you can take 0 to 4 markers: 5 options. With one notebook 7 is left, enough for 0 to 2 markers: 3 options. With two notebooks 2 is left, so no markers. In total 5 + 3 + 1 = 9.
budget=3, notebook_price=4, marker_price=7 → 1
Nothing is affordable, so the only option is to buy nothing.
budget, notebook_price, marker_price ≤ 10⁶budget=12, notebook_price=5, marker_price=3
9
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.