DIividing Candies
Chef has gone to the candy store, to buy a jar of candies for his kids. There are $N$ jars, the $i$-th jar having $A_i$ candies. Chef has $X$ children, and therefore he requires that whichever jar he chooses must have candies evenly divisible among all his $X$ children, so that there is no fighting. Among all such jars, Chef will choose the largest jar (i.e. the one with the most candies). Fin
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