#C9558. Calculate Character Speed with Encumbrance
Calculate Character Speed with Encumbrance
Calculate Character Speed with Encumbrance
Given a character's race and level of encumbrance, calculate the character's speed in feet per round. The base speeds for each race are as follows:
- Human: 30 feet/round
- Elf: 35 feet/round
- Dwarf: 25 feet/round
- Halfling: 25 feet/round
The encumbrance modifiers are:
- Light: 0 feet
- Medium: -10 feet
- Heavy: -20 feet
The final speed is calculated as follows:
\( \text{Final Speed} = \max(0, \text{Base Speed} + \text{Modifier}) \)
You need to implement a program that reads the character's race and encumbrance from standard input and prints the computed final speed to standard output.
inputFormat
The input consists of two lines:
- The first line is a string representing the character's race (one of
Human
,Elf
,Dwarf
, orHalfling
). - The second line is a string representing the encumbrance type (one of
Light
,Medium
, orHeavy
).
outputFormat
Output a single integer representing the character's final speed in feet per round after applying the encumbrance modifier. If the calculated speed is less than 0, output 0.
## sampleHuman
Light
30