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
84 lines
1.7 KiB
Markdown
84 lines
1.7 KiB
Markdown
---
|
|
id: 697a49e6ff50d756c9b6935f
|
|
title: "Challenge 182: 2026 Winter Games Day 3: Biathlon"
|
|
challengeType: 29
|
|
dashedName: challenge-182
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given an array of integers, where each value represents the number of targets hit in a single round of a biathlon, return the total penalty distance the athlete must ski.
|
|
|
|
- Each round consists of 5 targets.
|
|
- Each missed target results in a 150 meter penalty loop.
|
|
|
|
# --hints--
|
|
|
|
`calculate_penalty_distance([4, 4])` should return `300`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(calculate_penalty_distance([4, 4]), 300)`)
|
|
}})
|
|
```
|
|
|
|
`calculate_penalty_distance([5, 5])` should return `0`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(calculate_penalty_distance([5, 5]), 0)`)
|
|
}})
|
|
```
|
|
|
|
`calculate_penalty_distance([4, 5, 3, 5])` should return `450`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(calculate_penalty_distance([4, 5, 3, 5]), 450)`)
|
|
}})
|
|
```
|
|
|
|
`calculate_penalty_distance([5, 4, 5, 5])` should return `150`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(calculate_penalty_distance([5, 4, 5, 5]), 150)`)
|
|
}})
|
|
```
|
|
|
|
`calculate_penalty_distance([4, 3, 0, 3])` should return `1500`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(calculate_penalty_distance([4, 3, 0, 3]), 1500)`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def calculate_penalty_distance(rounds):
|
|
|
|
return rounds
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def calculate_penalty_distance(rounds):
|
|
total_penalty = 0
|
|
|
|
for hits in rounds:
|
|
misses = 5 - hits
|
|
total_penalty += misses * 150
|
|
|
|
return total_penalty
|
|
```
|