Optimal Fantasy Team Selection Within Budget Cap
Problem
You are given n cricket players, each with a creditCost and a predictedScore. With a budget cap of 100 credits you must pick exactly 11 players to maximise the total predicted score, while respecting role quotas.
Input / Output
- Input: a list of
nplayers each with{cost, score, role}, a budget of 100 credits, and a team size of 11. - Output: the maximum achievable total predicted score and the selected team.
Constraints
15 <= n <= 300 <= cost <= 15(fractional, one decimal place)- Role quotas: at least 1 wicket-keeper, 3-5 batsmen, 1-3 all-rounders, 3-5 bowlers.
Example
players = [{cost:9.5, score:85}, {cost:8.0, score:70}, ...](n=15),budget = 100,teamSize = 11-> the maximum predicted score and the chosen 11.
added …