All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Shapes
Count the ways... (Posted on 2005-10-28) Difficulty: 2 of 5
How many ways can you fit 8 identical 2 by 1 rectangles into a 4 by 4 square? Reflections and rotations count separately.

See The Solution Submitted by Tristan    
Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 6

The following are the 36 patterns found by computer.  Indeed, each reflection and rotation is counted as a separate way.  It might also be interesting to classify by reflection and rotation.  As a start toward classification, below each layout is shown the number of horizontal and vertical rectangles within each layout.

aabb  aabb  aabb  aabb  aabb  aabb
ccdd  ccdd  ccdd  ccdd  ccdd  ccde
eeff  eefg  effg  efgg  efgh  ffde
gghh  hhfg  ehhg  efhh  efgh  gghh
8  0  6  2  6  2  6  2  4  4  6  2
aabb  aabb  aabb  aabb  aabb  aabc
ccde  cdde  cdee  cdee  cdef  ddbc
fgde  cffe  cdff  cdfg  cdef  eeff
fghh  gghh  gghh  hhfg  gghh  gghh
4  4  6  2  6  2  4  4  4  4  6  2
aabc  aabc  aabc  aabc  aabc  aabc
ddbc  ddbc  ddbc  ddbc  debc  debc
eefg  effg  efgg  efgh  deff  defg
hhfg  ehhg  efhh  efgh  gghh  hhfg
4  4  4  4  4  4  2  6  4  4  2  6
abbc  abbc  abbc  abbc  abbc  abbc
addc  addc  addc  addc  addc  adec
eeff  eefg  effg  efgg  efgh  fdeg
gghh  hhfg  ehhg  efhh  efgh  fhhg
6  2  4  4  4  4  4  4  2  6  2  6
abcc  abcc  abcc  abcc  abcc  abcc
abdd  abdd  abdd  abdd  abdd  abde
eeff  eefg  effg  efgg  efgh  ffde
gghh  hhfg  ehhg  efhh  efgh  gghh
6  2  4  4  4  4  4  4  2  6  4  4
abcc  abcd  abcd  abcd  abcd  abcd
abde  abcd  abcd  abcd  abcd  abcd
fgde  eeff  eefg  effg  efgg  efgh
fghh  gghh  hhfg  ehhg  efhh  efgh
2  6  4  4  2  6  2  6  2  6  0  8

Notice for example how the solution at the top left is actually the same, rotated, as the one at the lower right.  The letters are merely for identification of which half-rectangle goes with which other.

DECLARE SUB place ()
DIM SHARED sz, numb, solCt, lvl, vCt, hCt
sz = 4: numb = sz * sz / 2
DIM SHARED board$(sz, sz)
CLS

place

SUB place
 lvl = lvl + 1
 ltr$ = MID$("abcdefghijklmnopqrstuvwxyz", lvl, 1)
 found = 0
 FOR i = 1 TO sz
 FOR j = 1 TO sz
   IF LTRIM$(board$(i, j)) = "" THEN
      rw = i: cl = j: found = 1: EXIT FOR
   END IF
 NEXT
 IF found THEN EXIT FOR
 NEXT
 IF found = 0 THEN
   rw = solCt \ 6: cl = solCt MOD 6
   solCt = solCt + 1
   FOR i = 1 TO sz
    LOCATE rw * 6 + i, cl * 6 + 1
    FOR j = 1 TO sz
     PRINT board$(i, j);
    NEXT
   NEXT
   LOCATE rw * 6 + sz + 1, cl * 6 + 1
   PRINT USING "# ##"; hCt; vCt;
 ELSE
   ' horiz
   IF cl < sz THEN
   IF board$(rw, cl + 1) = "" THEN

    board$(rw, cl) = ltr$
    board$(rw, cl + 1) = ltr$
    hCt = hCt + 1

    place

    hCt = hCt - 1
    board$(rw, cl) = ""
    board$(rw, cl + 1) = ""

   END IF
   END IF
   ' vert
   IF rw < sz THEN
   IF board$(rw + 1, cl) = "" THEN

    board$(rw, cl) = ltr$
    board$(rw + 1, cl) = ltr$
    vCt = vCt + 1

    place

    vCt = vCt - 1
    board$(rw, cl) = ""
    board$(rw + 1, cl) = ""

   END IF
   END IF
 END IF
 lvl = lvl - 1
END SUB

 


  Posted by Charlie on 2005-10-28 10:27:06
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information