← All problemsSign in

Little Chef and Cake

Little Chef doesn't like repeated things. He calls a number n Good if there are no repeating prime factors in its prime decomposition. Little Chef has just won the best chef award. There is a huge cake with N pieces arranged in a single row. Each piece of cake was made by a different chef; so each piece i has a score Ai associated with it. The score of multiple pieces of cake is the product of th

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start