← All problemsSign in

Plus 2 or Minus 1

CodeChefRating 1098Open on judge ↗

Chef has a number $X$ whose value is initially $0$. In one move, he can do one of the following: - Increment $X$ by $2$ i.e. $X := X + 2$ - Decrement $X$ by $1$ i.e. $X := X - 1$ He can perform **at most** $Y$ moves. He wants to determine how many distinct values can $X$ have after performing at most $Y$ moves. ### Input - The first line of input will contain a single integer $T$, denoting the n

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