A Negative Base Problem
CodeChefOpen on judge ↗
We knows about base->2 (binary) integers and base->10 (decimal) integers, and various other positive bases. But what about negative bases. OK! lets talk about the "base-> -2". An integer n written in base -2 is a sequence of digits written right-to-left. Each of which is either 0 or 1 (no negative digits!), and the following equality must hold: n = b0 + b1(-2) + b2(-2)2 + b3(-2)3 + ... The cool th
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