dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
2.6 KiB
2.6 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 697a49e6ff50d756c9b69366 | Challenge 189: 2026 Winter Games Day 10: Alpine Skiing | 29 | challenge-189 |
--description--
Given a ski hill's vertical drop, horizontal distance, and type, determine the difficulty rating of the hill.
To determine the rating:
- Calculate the steepness of the hill by taking the drop divided by the distance.
- Then, calculate the adjusted steepness based on the hill type:
"Downhill": multiply steepness by 1.2"Slalom": multiply steepness by 0.9"Giant Slalom": multiply steepness by 1.0
Return:
"Green"if the adjusted steepness is less than or equal to 0.1"Blue"if the adjusted steepness is greater than 0.1 and less than or equal to 0.25"Black"if the adjusted steepness is greater than 0.25
--hints--
get_hill_rating(95, 900, "Slalom") should return "Green".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(95, 900, "Slalom"), "Green")`)
}})
get_hill_rating(620, 2800, "Downhill") should return "Black".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(620, 2800, "Downhill"), "Black")`)
}})
get_hill_rating(420, 1680, "Giant Slalom") should return "Blue".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(420, 1680, "Giant Slalom"), "Blue")`)
}})
get_hill_rating(250, 3000, "Downhill") should return "Green".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(250, 3000, "Downhill"), "Green")`)
}})
get_hill_rating(110, 900, "Slalom") should return "Blue".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(110, 900, "Slalom"), "Blue")`)
}})
get_hill_rating(380, 1500, "Giant Slalom") should return "Black".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(380, 1500, "Giant Slalom"), "Black")`)
}})
--seed--
--seed-contents--
def get_hill_rating(drop, distance, hill_type):
return drop
--solutions--
def get_hill_rating(drop, distance, hill_type):
steepness = drop / distance
if hill_type == "Downhill":
steepness *= 1.2
elif hill_type == "Slalom":
steepness *= 0.9
elif hill_type == "Giant Slalom":
steepness *= 1.0
if steepness <= 0.1:
return "Green"
elif steepness <= 0.25:
return "Blue"
else:
return "Black"