← All problemsSign in

Product Equal Sum

CodeChefRating 2111Open on judge ↗

An array $A$ of length $N$ is said to be good if $A_1 \cdot A_2 \cdot \ldots A_N = A_1 + A_2 + \ldots + A_N$, i.e. product equals sum. --- Given an array $A$ of length $N$, count how many subarrays of $A$ are good. Formally, find the number of pairs $(L, R)$ such that: - $1 \le L \le R \le N$ - The array $[A_L, A_{L + 1}, A_{L + 2}, \ldots, A_R]$ is good. ### Input - The first line of input wi

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