Cut a rectangle

From Rosetta Code
Revision as of 08:49, 8 October 2011 by rosettacode>Ledrug (draft task (svg never works out here))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Cut a rectangle is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Given a rectangle made of m × n squares, if m and n are not both odd, it's possible to cut a path through the rectangle along the square edges such that the rectangle splits into two connected pieces with the same shape (after rotating one of them by 180°). All such paths for 2 × 2 and 4 × 3 rectangles are shown below.

Write a program to calculate the number of different ways to cut an m × n rectangle. Optionally, show each of the cuts.