Problems > The Two Jugs > Editorial

The Two Jugs — Solution & Editorial

Back to the Problem

Bézout: reachable totals are exactly the multiples of gcd(A, B) up to A+B.

Complexity: O(log)