GCD of the Submasks
For a non-negative integer $X$, the function $G(X)$ is defined as the greatest common divisor of all the integers generated by all submasks of the binary representation of $X$, i.e. integers obtained by replacing some (possibly none or all) $1$-s in this binary representation by $0$-s. You are given an integer $N$. Find $S = \sum_{X=1}^N X^{G(X)}$ modulo $998,244,353$. ### Input - The first
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