3.5 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 697a49e9860d24853adef67c | Challenge 191: 2026 Winter Games Day 12: Bobsled | 29 | challenge-191 |
--description--
Given an array representing the weights of the athletes on a bobsled team and a number representing the weight of the bobsled, determine whether the team is eligible to race.
- The length of the array determines the team size: 1, 2 or 4 person teams.
- All given weight values are in kilograms (kg).
The bobsled (sled by itself) must have a minimum weight of:
- 162 kg for a 1-person team
- 170 kg for a 2-person team
- 210 kg for a 4-person team
The total weight of the bobsled (athletes plus sled) must not exceed:
- 247 kg for a 1-person team
- 390 kg for a 2-person team
- 630 kg for a 4-person team
Return "Eligible" if the team meets all the requirements, or "Not Eligible" if the team fails to meet one or more of the requirements.
--hints--
check_eligibility([78], 165) should return "Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([78], 165), "Eligible")`)
}})
check_eligibility([80], 160) should return "Not Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([80], 160), "Not Eligible")`)
}})
check_eligibility([80], 170) should return "Not Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([80], 170), "Not Eligible")`)
}})
check_eligibility([85, 90], 170) should return "Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([85, 90], 170), "Eligible")`)
}})
check_eligibility([85, 95], 168) should return "Not Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([85, 95], 168), "Not Eligible")`)
}})
check_eligibility([112, 97], 185) should return "Not Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([112, 97], 185), "Not Eligible")`)
}})
check_eligibility([110, 102, 90, 106], 222) should return "Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([110, 102, 90, 106], 222), "Eligible")`)
}})
check_eligibility([106, 99, 90, 88], 205) should return "Not Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([106, 99, 90, 88], 205), "Not Eligible")`)
}})
check_eligibility([106, 99, 103, 96], 227) should return "Not Eligible".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([106, 99, 103, 96], 227), "Not Eligible")`)
}})
--seed--
--seed-contents--
def check_eligibility(athlete_weights, sled_weight):
return athlete_weights
--solutions--
def check_eligibility(athlete_weights, sled_weight):
team_size = len(athlete_weights)
rules = {
1: {"min_sled": 162, "max_total": 247},
2: {"min_sled": 170, "max_total": 390},
4: {"min_sled": 210, "max_total": 630}
}
min_sled = rules[team_size]["min_sled"]
max_total = rules[team_size]["max_total"]
total_weight = sum(athlete_weights) + sled_weight
if sled_weight < min_sled:
return "Not Eligible"
if total_weight > max_total:
return "Not Eligible"
return "Eligible"