Chef and Powers
CodeChefOpen on judge ↗
Chef has 2 integers, $n$ and $k$. He has an array $A$ of size $n$. He wants to find the number of integers from 1 to $k$(including 1 and $k$) which are perfect $A_i$th power for every $i$, $1 \leq i \leq n$. A perfect $x$th power is a number of the form $m^x$, where $m \geq 1$ is a positive integer. For example, if $x$=4, then $y$=1,16,81 etc. are perfect 4th power numbers. Can you help Chef in
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