C++20 sections · 1024 units
Open in Course

Domino piling - The Idea

Think about total space

The insight: each domino covers exactly 2 cells. The board has M×NM \times N cells total. So the maximum number of dominoes is (M × N) / 2. You're dividing the total area by the domino size.

Wait, but what about odd areas? If M×N=15M \times N = 15, you can't place 7.57.5 dominoes. That's where integer division comes in. Floor division (M × N) / 2 gives you the answer, automatically handling the leftover cell.

You don't need to simulate placement. No loops, no complex logic. Just multiply the dimensions and divide by 2. This transforms a geometric problem into a single arithmetic operation.