← All problemsSign in

XOR And Multiply

CodeChefRating 1941Open on judge ↗

Chef has a favourite positive integer $X$. He wondered if there are two positive integers $a$, $b$ such that: - $1\le a, b \le 8 \cdot 10^{18}$; - The values $a$ $\&$ $b$ and $a \oplus b$ are **positive** and **divisible** by $X$. Note that $\&$ and $\oplus$ denote [bitwise and](https://en.wikipedia.org/wiki/Bitwise_operation#AND) and [bitwise xor](https://en.wikipedia.org/wiki/Bitwise_operation

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