public static List<int> CalculateBracketSizes(int teamCount)
{
// Percentages of competitors falling into each bracket
const float DIAMOND_PERCENT_USERS = 0.03f;
const float PLATINUM_PERCENT_USERS = 0.08f;
const float GOLD_PERCENT_USERS = 0.15f;
const float SILVER_PERCENT_USERS = 0.25f;
float percentAssigned = 0;
int diamondCount = (teamCount > 0 ?
(int)Math.Max(Math.Round(DIAMOND_PERCENT_USERS * teamCount), 1) : 0);
percentAssigned += DIAMOND_PERCENT_USERS;
teamCount -= diamondCount;
int platinumCount = (teamCount > 0 ?
(int)Math.Max(Math.Round(PLATINUM_PERCENT_USERS / (1 - percentAssigned) * teamCount), 1) : 0);
percentAssigned += PLATINUM_PERCENT_USERS;
teamCount -= platinumCount;
int goldCount = (teamCount > 0 ?
(int)Math.Max(Math.Round(GOLD_PERCENT_USERS / (1 - percentAssigned) * teamCount), 1) : 0);
percentAssigned += GOLD_PERCENT_USERS;
teamCount -= goldCount;
int silverCount = (teamCount > 0 ?
(int)Math.Max(Math.Round(SILVER_PERCENT_USERS / (1 - percentAssigned) * teamCount), 1) : 0);
percentAssigned += SILVER_PERCENT_USERS;
teamCount -= silverCount;
int bronzeCount = teamCount;
return new List<int> { bronzeCount, silverCount, goldCount, platinumCount, diamondCount };
}