← All problemsSign in

Another Expected Value Problem

You are given a sequence $A$ consisting of $N$ positive integers. Let $f(S)$ be defined for a non-empty subsequence $S$ as follows: $f(S) = \frac{g}{l + 1} $ where $g$ is GCD of the elements of the subsequence $S$ and $l$ is the length of the subsequence $S$. Find the expected value of $f(S)$ if all the non-empty subsequences are equiprobable. ### Input - The first line of the input contains

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