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
103 lines
2.4 KiB
Markdown
103 lines
2.4 KiB
Markdown
---
|
|
id: 697a49e6ff50d756c9b6935e
|
|
title: "Challenge 181: 2026 Winter Games Day 2: Snowboarding"
|
|
challengeType: 29
|
|
dashedName: challenge-181
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given a snowboarder's starting stance and a rotation in degrees, determine their landing stance.
|
|
|
|
- A snowboarder's stance is either `"Regular"` or `"Goofy"`.
|
|
- Trick rotations are multiples of 90 degrees. Positive indicates clockwise rotation, and negative indicate counter-clockwise rotation.
|
|
- The landing stance flips every 180 degrees of rotation.
|
|
|
|
For example, given `"Regular"` and `90`, return `"Regular"`. Given `"Regular"` and `180` degrees, return `"Goofy"`.
|
|
|
|
# --hints--
|
|
|
|
`get_landing_stance("Regular", 90)` should return `"Regular"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Regular", 90), "Regular")`)
|
|
}})
|
|
```
|
|
|
|
`get_landing_stance("Regular", 180)` should return `"Goofy"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Regular", 180), "Goofy")`)
|
|
}})
|
|
```
|
|
|
|
`get_landing_stance("Goofy", -270)` should return `"Regular"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Goofy", -270), "Regular")`)
|
|
}})
|
|
```
|
|
|
|
`get_landing_stance("Regular", 2340)` should return `"Goofy"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Regular", 2340), "Goofy")`)
|
|
}})
|
|
```
|
|
|
|
`get_landing_stance("Goofy", 2160)` should return `"Goofy"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Goofy", 2160), "Goofy")`)
|
|
}})
|
|
```
|
|
|
|
`get_landing_stance("Goofy", -540)` should return `"Regular"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Goofy", -540), "Regular")`)
|
|
}})
|
|
```
|
|
|
|
`get_landing_stance("Goofy", 90)` should return `"Goofy"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_landing_stance("Goofy", 90), "Goofy")`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def get_landing_stance(start_stance, rotation):
|
|
|
|
return start_stance
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def get_landing_stance(start_stance, rotation):
|
|
flips = abs(rotation) // 180
|
|
if flips % 2 == 0:
|
|
return start_stance
|
|
else:
|
|
return "Goofy" if start_stance == "Regular" else "Regular"
|
|
```
|