Cutting a chocolate bar

Revision en1, by maulik12, 2015-07-12 08:14:38

I recently encountered this question from one of my friends. You are given an chocolate bar of size M*N. Also you are given an array of pieces to be cut. Example: If M- 3 and N = 4, the array that is given is : 1,2,3 and 6

We can divide the chocolate into such rectangular pieces of these sizes. Note that the sizes have to be rectangular.

Can we do this just by checking the sum and then see if the following constraints are satisfied:

  1. I am using just a verification that if the size to be cut(K) is odd, then the value of M or N has to be greater than or equal to K, then only we can cut it into (1 X K) or (K X 1).

I do not get whether this is an advanced problem or just some ad hoc problem. Please advice on how to solve the question and ask any queries.

Tags adhoc, chocolate

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English maulik12 2015-07-12 08:14:38 805 Initial revision (published)