Expected Number of Customers
A cake consists of $N$ pieces arranged in a row. Each piece has one of $M$ distinct flavours (numbered $1$ through $M$) which are available in Chef's kitchen. For each valid $i$, the cost of the $i$-th flavour is $i$ rupees. When Chef bakes a cake, he chooses the flavour of each piece independently and uniformly randomly from these $M$ flavours. After baking the cake, he splits it into several
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