Have You Met Ted
CodeChefOpen on judge ↗
$Ted$ loves prime numbers. One day he is playing a game called $legendary$ with his girlfriend $Robin$. $Ted$ writes a number $N$ on a table and the number is in the form of : N = P1A1 * P2A2 * ........... * PnAn $Ted$ asks $Robin$ to find the sum of all the numbers which are less than or equal to $N$ and also contains all the primes whose minimum power in the number is given by an array $B$. A
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