Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
 Already signed up? New to KöMaL?

# Problem I. 148. (January 2007)

I. 148. Members of a certain class give Christmas presents to one another in the following way: everybody prepares similar-looking boxes for everyone else with a student's name printed on each. Every gift box contains different items (repetition is possible), but there is at least one unique item in each box. (For example, Pete packs one bar of chocolate and one toy car into each box, Johnny packs one book and one pen, while Cecil packs one bar of chocolate and one book, etc.) Of course, no one gives a present to him- or herself.

After the celebration they would like to figure out who gave which present, so they list their new presents in a worksheet. Your task is to prepare a worksheet that prints on a different worksheet who gave which present.

The first two cells of the first row of the first worksheet contain the number of students N (1<N<40) and the number of different items M (1<M<100). Beginning with the second row, the first worksheet is structured as follows: every row corresponds to a student and every column corresponds to an item, while a cell in a certain column and row says how many items of that kind the others gave to the actual student. Your solution should be placed onto the second worksheet in a similar format: a cell in a certain column and row should say how many items of that kind the actual student gave to the others. Invalid cells should be left blank.

The sheet (i148.xls, ...) is to be submitted.

(10 pont)

Deadline expired on February 15, 2007.

Sorry, the solution is available only in Hungarian. Google translation