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
117 lines
2.6 KiB
Markdown
117 lines
2.6 KiB
Markdown
---
|
|
id: 697a49e6ff50d756c9b69360
|
|
title: "Challenge 183: 2026 Winter Games Day 4: Ski Jumping"
|
|
challengeType: 29
|
|
dashedName: challenge-183
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given distance points, style points, a wind compensation value, and K-point bonus value, calculate your score for the ski jump and determine if you won a medal or not.
|
|
|
|
- Your score is calculated by summing the above four values.
|
|
|
|
The current total scores of the other jumpers are:
|
|
|
|
```sh
|
|
165.5
|
|
172.0
|
|
158.0
|
|
180.0
|
|
169.5
|
|
175.0
|
|
162.0
|
|
170.0
|
|
```
|
|
|
|
- If your score is the best, return `"Gold"`
|
|
- If it's second best, return `"Silver"`
|
|
- If it's third best, return `"Bronze"`
|
|
- Otherwise, return `"No Medal"`
|
|
|
|
# --hints--
|
|
|
|
`ski_jump_medal(125.0, 58.0, 0.0, 6.0)` should return `"Gold"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(ski_jump_medal(125.0, 58.0, 0.0, 6.0), "Gold")`)
|
|
}})
|
|
```
|
|
|
|
`ski_jump_medal(119.0, 50.0, 1.0, 4.0)` should return `"Bronze"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(ski_jump_medal(119.0, 50.0, 1.0, 4.0), "Bronze")`)
|
|
}})
|
|
```
|
|
|
|
`ski_jump_medal(122.0, 52.0, -1.0, 4.0)` should return `"Silver"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(ski_jump_medal(122.0, 52.0, -1.0, 4.0), "Silver")`)
|
|
}})
|
|
```
|
|
|
|
`ski_jump_medal(118.0, 50.5, -1.5, 4.0)` should return `"No Medal"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(ski_jump_medal(118.0, 50.5, -1.5, 4.0), "No Medal")`)
|
|
}})
|
|
```
|
|
|
|
`ski_jump_medal(124.0, 50.5, 2.0, 5.0)` should return `"Gold"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(ski_jump_medal(124.0, 50.5, 2.0, 5.0), "Gold")`)
|
|
}})
|
|
```
|
|
|
|
`ski_jump_medal(119.0, 49.5, 0.0, 3.0)` should return `"No Medal"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(ski_jump_medal(119.0, 49.5, 0.0, 3.0), "No Medal")`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def ski_jump_medal(distance_points, style_points, wind_comp, k_point_bonus):
|
|
|
|
return distance_points
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def ski_jump_medal(distance_points, style_points, wind_comp, k_point_bonus):
|
|
my_score = distance_points + style_points + wind_comp + k_point_bonus
|
|
other_scores = [165.5, 172.0, 158.0, 180.0, 169.5, 175.0, 162.0, 170.0]
|
|
all_scores = other_scores + [my_score]
|
|
all_scores.sort(reverse=True)
|
|
rank = all_scores.index(my_score) + 1
|
|
|
|
if rank == 1:
|
|
return "Gold"
|
|
elif rank == 2:
|
|
return "Silver"
|
|
elif rank == 3:
|
|
return "Bronze"
|
|
else:
|
|
return "No Medal"
|
|
```
|