in reply to Re: Sports Team allocation
in thread Sports Team allocation
In your case, there are a possible 12271512 different team combinations, but this isn't the complete answer yet. You'll actually want to generate these teams such that you can find which of them have repeated couples.sub choose { my ($n, $k) = @_; my ($result, $j) = (1, 1); return 0 if $k > $n || $k < 0; $k = ($n - $k) if ($n - $k) < $k; while ( $j <= $k ) { $result *= $n--; $result /= $j++; } return $result; } my $people = 48; my $teams = 8; my $seasons = 3; print choose($people, ($people/$teams));
I've got some coding for work to do, but I'll crunch on this throughout the day and update as I can, barring someone else having more freetime and posting a solution before I do.
C-.
Update: Or you could completely ignore my intellectually overstimulated response and go with what Abigail-II suggested, which will actually solve the problem. Thanks for the instruction.
---
Flex the Geek
|
|---|