2240. Number of Ways to Buy Pens and Pencils
On This Page
class Solution:
def waysToBuyPensPencils(self, total: int, cost1: int, cost2: int) -> int:
res = 0
for x in range(total // cost1 + 1):
y = (total - (x * cost1)) // cost2 + 1
res += y
return res