← All problemsSign in

Subtract or Divide

CodeChefRating 1445Open on judge ↗

You are given a positive integer $N$. In one operation, you can do **either** of the following $2$ actions: - If $N > 2$, choose to change $N$ to $N - 2$. - If $N > 1$ and $N$ is even, choose to change $N$ to $\dfrac{N}{2}$ Find the number of different positive integers you can form if you are allowed to perform as many operations as you want, starting with $N$. Note that you are allowed to perf

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