Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Buy Pens and Pencils

Try to solve the Number of Ways to Buy Pens and Pencils problem.

Statement

You are given an integer total representing an amount of money, and two integers cost1 and cost2 representing the price of a pen and a pencil, respectively.

Return the number of distinct ways to purchase some number of pens and pencils such that the total cost spent does not exceed total. You may purchase 00 pens and 00 pencils.

Constraints:

  • 1≤1 \leq total, cost1, cost2 ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Ways to Buy Pens and Pencils

Try to solve the Number of Ways to Buy Pens and Pencils problem.

Statement

You are given an integer total representing an amount of money, and two integers cost1 and cost2 representing the price of a pen and a pencil, respectively.

Return the number of distinct ways to purchase some number of pens and pencils such that the total cost spent does not exceed total. You may purchase 00 pens and 00 pencils.

Constraints:

  • 1≤1 \leq total, cost1, cost2 ≤106\leq 10^6