← All problemsSign in

Polynomial Root

CodeChefRating 2967Open on judge ↗

Let's define a function $P(x, y) = (x-y)^2$. For given real numbers $a$ and $b$, let's define a polynomial $Q_{a,b}(x) = P(P(P(x, a), a-b), x-b)$. Next, let's define a function $F(a, b)$: - If $Q_{a,b}(x)$ has no real roots, $F(a, b) = 0$. - Otherwise, let $r$ be the largest real root of $Q_{a,b}(x)$. - If $r$ is rational, it can be represented by a fraction $r = \frac{p}{q}$, where $p$ and

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