On the top of my head: (N mod 6) mod 5 =0 (where N is the number of users) creates the maximum nr of groups with 6 users and minimum nr of groups with 5 users.
Marc _______________________ Verzonden van mobiel Op 12 apr. 2012 22:34 schreef "KB" <[email protected]> het volgende: > I have a list of users which is of a variable length. I need to sort > them into teams of 5 and 6, leaving nobody unassigned (when > possible). > I should minimize the total number of teams, creating as the most > number of 6 person teams and least number of 5 person teams possible. > > Couple Examples: > 1. If my list is 89 users long, create 14x6 and 1x5 (15 teams total) > 2. If my list is 114 users long, create 19x6 and 0x5 (19 teams total) > 3. If my list is 31 users long, create 1x6 and 5x5 (6 teams total) > > > You get the idea. How would you solve this programatically? In the > end, I need to update a database table assigning each user to a team. > > > I'm working out a solution, but I know there has to be a better way > and figured I'd tap into the collective brain power of this group for > help. > > > Thanks! > > > KB > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" 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/model-glue?hl=en > -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" 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/model-glue?hl=en
