← All problemsSign in

A Triangle and Two Squares

You are given two squares A and B. The square A has a side length of $a$ and B has a side length of $b$. The left-bottom point of square A is at $(0, 0)$ and the top-right at $(a, a)$. Square B's left-bottom point is $(x, y)$ and top-right is $(x + b, y + b)$. It's guaranteed that square B lies inside square A (may not be strictly inside, can touch too). In other words, $0 \leq x, 0 \leq y, (x + b

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