Files
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.7 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
697a49e6ff50d756c9b6935f Challenge 182: 2026 Winter Games Day 3: Biathlon 29 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.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([4, 4]), 300)`)
}})

calculate_penalty_distance([5, 5]) should return 0.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([5, 5]), 0)`)
}})

calculate_penalty_distance([4, 5, 3, 5]) should return 450.

({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.

({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.

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([4, 3, 0, 3]), 1500)`)
}})

--seed--

--seed-contents--

def calculate_penalty_distance(rounds):

    return rounds

--solutions--

def calculate_penalty_distance(rounds):
    total_penalty = 0

    for hits in rounds:
        misses = 5 - hits
        total_penalty += misses * 150

    return total_penalty