Norbert wrote:
> I'm unable to solve this problem correctly. Please help me:
>
> You have chess board of size N x M and a lot of bricks of size K x 1.
> How many bricks can you place on this board (brick edges must be
> pallarel to board edges)
>
> Thanks for help

Chessboards are always perfectly square, :) but anyway.

The problem is that you may have wasted space. Consider an 8 x 8
chessboard (standard size), where the bricks occupy 3 sqrs. in length,
and 1 in width.

11122234
77788834
999aaa34
bbbccc**
dddeee**
ggghhh56
kkksss56
... etc.

The ** area is wasted, even though the area is sufficient for another
brick (and then some), but it can't fit one in due to the constraint of
the length of the brick.

The program to calculate the number of bricks doesn't need to try every
possible combination, it merely needs to take the physical constraints
of the bricks dimensions, into account. Likewise if the space was in a
corner. Hard work getting those bricks to bend 90 degrees!

Adak


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to