← All problemsSign in

C - XOR LCM

You are given a positive integer $c$ ($1 \le c \le 10^7$). You need to find any two positive integers $a$ and $b$ such that: - $1 \le a, b \le 10^{17}$ - $ (a \oplus c) + (b \oplus c) = \text{lcm}(a, c) + \text{lcm}(b, c)$. Here, $\oplus$ denotes the bitwise XOR operator and $\text{lcm}(x, y)$ denotes the lowest common multiple of $x$ and $y$. It can be proven that it is always possible to fin

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