#23Factory Packaging
A factory has a certain number of products that need to be packed into identical boxes. Each box can hold exactly b products. Given the total number of products p and the capacity of each box b, determine the maximum number of completely filled boxes that can be produced.
The calculation must be performed without using multiplication (*), division (/), or modulo (%) operators. Only complete boxes are counted. Any products left over after filling the maximum number of boxes are ignored.
Examples
Example 1
Input: p = 23
b = 5
Output: 4
Explanation: 5 + 5 + 5 + 5 = 20 Four complete boxes can be filled, with 3 products remaining.
Example 2
Input: p = 41
b = 8
Output: 5
Explanation: 8 + 8 + 8 + 8 + 8 = 40 Five complete boxes can be filled, with 1 product remaining.
Example 3
Input: p = 7
b = 10
Output: 0
Explanation: There are not enough products to fill even one complete box.
Constraints
- 1 ≤ p ≤ 2³¹ - 1
- 1 ≤ b ≤ 2³¹ - 1
- The answer must fit within the signed 32-bit integer range.
