# Thread: help in a problem

1. ## help in a problem

plz i want help in this problem i can't understand it
Code:
There are G girl students and B boy students in a class that is about to graduate. You
need to arrange them in a single row for the graduation. To give a better impression of
diversity, you want to avoid having too many girls or too many boys seating consecutively.
You decided to arrange the students in order to minimize the gender regularity. The
gender regularity of an arrangement is the maximum number of students of the same
gender (all girls or all boys) that appear consecutively.
Given G and B, calculate the minimum gender regularity among all possible arrange-
ments.
the example
Code:
 G = 5 , B = 1
result = 3

2. Looks like a straightforward combinatorics problem. If maximum gender regularity is the maximum number of students of the same gender (all girls or all boys) that appear consecutively, then minimum gender regularity should be the combination that has the minimum number of students of the same gender (all girls or all boys) that appear consecutively.

So look at each permutation and identify the minimum gender regularity:

B G G G G G - maximum gender regularity (five girls consecutively)
G B G G G G
G G B G G G - minimum gender regularity (three girls consecutively)
G G G B G G - minimum gender regularity (three girls consecutively)
G G G G B G
G G G G G B - also maximum gender regularity (five girls consecutively)

3. Originally Posted by BIOS
Looks like a straightforward combinatorics problem. If maximum gender regularity is the maximum number of students of the same gender (all girls or all boys) that appear consecutively, then minimum gender regularity should be the combination that has the minimum number of students of the same gender (all girls or all boys) that appear consecutively.

So look at each permutation and identify the minimum gender regularity:

B G G G G G - maximum gender regularity (five girls consecutively)
G B G G G G
G G B G G G - minimum gender regularity (three girls consecutively)
G G G B G G - minimum gender regularity (three girls consecutively)
G G G G B G
G G G G G B - also maximum gender regularity (five girls consecutively)
do u have hints to solve it by equation

4. Not sure on an equation. Here is another thread looking at the same problem:

Just another problem on combinatorics - Mathematics - Stack Exchange

Which suggests the equation changes with the ratio which isn't really helpful if we are working with variables.

Also worth looking at:

Combinatorial principles - Wikipedia, the free encyclopedia

Haven't really studied combinatorics before so hopefully one of the regular posters will give some input.

BIOS

5. $\lceil \frac{(max(G, B)}{min(G, B) + 1} \rceil$

Does this formula work ?

6. How do you apply that to the above for instance when the max is odd? The best i could come up with was for ratios where the smaller group is = 1 and the larger group is an odd number as in above. The formulas for both are:

a = bigger group
b = smaller group

$maximum=a-b$

$\displaystyle minimum=\frac {a+1}{2}$