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

2.1 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
697a49e6ff50d756c9b69360 Challenge 183: 2026 Winter Games Day 4: Ski Jumping 28 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:

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--

skiJumpMedal(125.0, 58.0, 0.0, 6.0) should return "Gold".

assert.equal(skiJumpMedal(125.0, 58.0, 0.0, 6.0), "Gold");

skiJumpMedal(119.0, 50.0, 1.0, 4.0) should return "Bronze".

assert.equal(skiJumpMedal(119.0, 50.0, 1.0, 4.0), "Bronze");

skiJumpMedal(122.0, 52.0, -1.0, 4.0) should return "Silver".

assert.equal(skiJumpMedal(122.0, 52.0, -1.0, 4.0), "Silver");

skiJumpMedal(118.0, 50.5, -1.5, 4.0) should return "No Medal".

assert.equal(skiJumpMedal(118.0, 50.5, -1.5, 4.0), "No Medal");

skiJumpMedal(124.0, 50.5, 2.0, 5.0) should return "Gold".

assert.equal(skiJumpMedal(124.0, 50.5, 2.0, 5.0), "Gold");

skiJumpMedal(119.0, 49.5, 0.0, 3.0) should return "No Medal".

assert.equal(skiJumpMedal(119.0, 49.5, 0.0, 3.0), "No Medal");

--seed--

--seed-contents--

function skiJumpMedal(distancePoints, stylePoints, windComp, kPointBonus) {

  return distancePoints;
}

--solutions--

function skiJumpMedal(distancePoints, stylePoints, windComp, kPointBonus) {
  const myScore = distancePoints + stylePoints + windComp + kPointBonus;
  const otherScores = [165.5, 172.0, 158.0, 180.0, 169.5, 175.0, 162.0, 170.0];
  const allScores = [...otherScores, myScore];
  allScores.sort((a, b) => b - a);
  const rank = allScores.indexOf(myScore) + 1;

  if (rank === 1) return "Gold";
  if (rank === 2) return "Silver";
  if (rank === 3) return "Bronze";
  return "No Medal";
}