Nice Array
You're given an array $A$ of length $N$, and an integer $K$. $A$ is said to be a *nice array* if there exists an array $B$ of length $N$ satisfying the following conditions: 1. For every index $i$ ($1 \leq i \leq N$), $B_i = \left\lfloor \frac{A_i}{K} \right\rfloor$, or $B_i = \left\lceil \frac{A_i}{K} \right\rceil$; and 2. $B_1 + B_2 + \ldots + B_N = 0$. Is $A$ a *nice array*? Note that $\left
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start