Add 1 or 3
You start with an integer $X = 0$. For $N$ turns, you do **exactly one** of the following: - Either, you add $1$ to $X$ - Or, you add $3$ to $X$ For example, for $N = 2$, you can choose to add $1$ on the first turn, and $3$ on the second turn, thus a final value of $X = 4$. Given an integer $M$, print whether it is possible that the final value of $X$ is $M$ or not. ### Input - The first line
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