2240. Number of Ways to Buy Pens and Pencils

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2240

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