Problem 478B

Правка en5, от ebanner, 2016-06-12 00:02:01

This problem gave me a great deal of trouble when I first encountered it. I figured out quickly enough that the answer to the maximum case was to make the largest team possible while putting as many participants in groups of size 1 to fulfill the requirement of having m groups. I also figured out that the solution for the minimum case was to put students in as "uniform" of groups as possible. It was figuring out how to put participants in these uniform groups which was the challenge!

In hindsight, my main difficulty was that I was lacking the interpretation of n % m necessary for this problem. The interpretation of n % m that has worked for me 99% of the time for me was to view the quantity n % m as the number r such that n = k*m + r, where 0 <= r < m. Intuitively, this can be thought of as repeatedly summing m until it gets within m units of n and then calling the remainder r. Another way to view this procedure is that we are making as many groups of size m out of n as we possibly can. Unfortunately this problem calls for making exactly m groups, which are almost certainly not of size m!

As a review, the quantity n / m expresses the answer to the following two scenarios:

  • We have n pieces and want to split them into groups of size m. How many groups are there?
  • We have n pieces and want to split them into m groups. How many are in each group?

Since n % m and n / m are intimately related, it turns out that n % m also can be interpreted in both of these ways, also! To illustrate the first interpretation of n % m, consider the example 8 % 3. We can arrive at the answer using the following procedure:

(3 + 3) + 2

Hence 8 % 3 = 2. The procedure we used was to split 8 into groups of size 3 and count the leftover pieces. However, if we want to use the interpretation of making 3 groups, we need to do a little bit more work. In order to illustrate this perspective, consider the analagous illustration of 8 / 3:

2.67 2.67 2.67

That is, if we wish to make 3 groups out of 8 pieces then we need 2.67 pieces in each group. But notice we can manipulate this expression in the following way:

2.67 2.67 2.67 = (2 + 2 + 2) + (.67 + .67 + .67) = (2 + 2 + 2) + 2.

That is, we take the decimal components of each of the groups and move them into their own group. Recall that 8 % 3 = 2. And notice with this alternate procedure we also arrived at a value of 2. This is not a coincidence! The difference here is that instead of making as many groups of size 3 that would get us up to 8 and computing the remainder, we made 3 groups of size 2. This gave us the same answer.

We can see that the operation of "removing the decimal component of a number" is equivalent n / m. And the sum of decimal components corresponds to n % m. In the general case, we have the following procedure for splitting up n participants into m groups with some leftover:

floor(n/m) floor(n/m) ... floor(n/m) (m times) + n % m

Relating this back to the original problem, all that remains is to distribute the leftover n % m participants as evenly as possible into the m groups we've computed. It's not hard to see the way to do this is to add one student to each group until we run out of leftover participants. Thus we wind up with m total teams, n % m of which have size floor(n/m)+1 and m — n % m of which have size n / m.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en27 Английский ebanner 2016-08-14 17:35:13 39 Tiny change: 'rite, but actually we can no' - (published)
en26 Английский ebanner 2016-08-14 17:27:58 2 Tiny change: 'to create m teams as ' -> 'to create `m` teams as '
en25 Английский ebanner 2016-08-14 17:27:31 130 Tiny change: ' quantity n / m denotes i' - (saved to drafts)
en24 Английский ebanner 2016-06-13 04:12:32 3 Tiny change: 'cipant to different teams. As a res' -> 'cipant to a different team. As a res'
en23 Английский ebanner 2016-06-13 04:11:59 3 Tiny change: 'rticipants)! All that ' -> 'rticipants!). All that '
en22 Английский ebanner 2016-06-13 04:11:12 74 Tiny change: 'rite, but we can no' -
en21 Английский ebanner 2016-06-12 20:45:49 12 Tiny change: ' However, this problem requires ' -> ' However, Problem 478B requires '
en20 Английский ebanner 2016-06-12 20:44:53 2 Tiny change: '%m.\n\nIn English, Eq' -> '%m.\n\nIn english, Eq'
en19 Английский ebanner 2016-06-12 20:41:36 42 Tiny change: 'nd up with the following equation:\n\nn = (n' - (published)
en18 Английский ebanner 2016-06-12 20:38:51 140 Tiny change: ' English, this can be re' - (saved to drafts)
en17 Английский ebanner 2016-06-12 20:28:32 11 Tiny change: 'th how to quantify that. Thi' -> 'th how to compute that. Thi'
en16 Английский ebanner 2016-06-12 20:26:07 75
en15 Английский ebanner 2016-06-12 20:23:25 28
en14 Английский ebanner 2016-06-12 20:21:42 133 Tiny change: 'nts.
en13 Английский ebanner 2016-06-12 20:11:08 301 Tiny change: 'buting n people into m te' - (published)
en12 Английский ebanner 2016-06-12 19:58:36 2947 Tiny change: 'ially. My understan' - (saved to drafts)
en11 Английский ebanner 2016-06-12 18:59:07 87
en10 Английский ebanner 2016-06-12 18:54:04 57 Tiny change: 'ave:\n\n8 % 3 = 3*2 + 2' - (published)
en9 Английский ebanner 2016-06-12 18:45:19 531 Tiny change: 'possible. It was figu' -
en8 Английский ebanner 2016-06-12 17:50:02 776 Tiny change: '2 + 2.\n\nHere we stripped off the d' -
en7 Английский ebanner 2016-06-12 17:37:47 898 Tiny change: '; (n/m)*m _(1)_\n\n' -
en6 Английский ebanner 2016-06-12 17:12:48 2108 (saved to drafts)
en5 Английский ebanner 2016-06-12 00:02:01 693 Tiny change: 'ins is to the remaining n % m par' - (published)
en4 Английский ebanner 2016-06-11 23:50:24 1111 Tiny change: ' related, n % m als' -
en3 Английский ebanner 2016-06-11 23:35:23 523 Tiny change: '7 + .67)\n ' -
en2 Английский ebanner 2016-06-11 22:47:14 871
en1 Английский ebanner 2016-06-11 22:00:44 1291 Initial draft (saved to drafts)