#K49362. Cookie Packaging Problem
Cookie Packaging Problem
Cookie Packaging Problem
You are given a total number of cookies N. Your task is to determine how many boxes can be completely filled, how many partial boxes (if any) can be used, and how many cookies are left unboxed. Each completely filled box holds exactly 20 cookies. A partially filled box must contain between 12 and 19 cookies (inclusive).
Formally, let \(N\) be the total number of cookies. Compute the number of full boxes as follows:
[ FullBoxes = \left\lfloor \frac{N}{20} \right\rfloor ]
Let \(R = N \bmod 20\). If \(12 \le R \le 19\), then exactly one partial box is used and there will be no leftover cookies. Otherwise, no partial box is used and \(R\) cookies remain unboxed. Your solution should use this method to minimize unboxed cookies.
inputFormat
Input consists of a single integer \(N\) (\(0 \leq N \leq 10^9\)) representing the total number of cookies.
outputFormat
Output three space-separated integers representing:
- The number of completely filled boxes (each holding 20 cookies).
- The number of partial boxes (which will be either 0 or 1).
- The number of leftover cookies.
89
4 0 9