#C7092. Adventurer Attributes Calculation
Adventurer Attributes Calculation
Adventurer Attributes Calculation
This problem involves calculating the attributes of an adventurer based on their level and character class. You are given a non-negative integer level and a string char_class which can be one of Warrior, Mage, or Rogue. Based on the following rules:
- Warrior:
$$hp = 10 \times level$$
$$attack\_bonus = 2 \times level$$
If $$level \geq 5$$, the adventurer gains the special ability "Power Strike". - Mage:
$$hp = 5 \times level$$
$$attack\_bonus = level$$
If $$level \geq 3$$, the adventurer gains the special ability "Fireball". - Rogue:
$$hp = 7 \times level$$
$$attack\_bonus = \lfloor 1.5 \times level \rfloor$$
If $$level \geq 2$$, the adventurer gains the special ability "Stealth".
If the provided char_class does not match any of these, all attributes remain zero. Your task is to compute and output the final attributes as a JSON object.
inputFormat
The input is given as two lines:
- The first line contains a non-negative integer representing the level.
- The second line contains a string representing the character class.
outputFormat
Output a JSON object (as a single line) with the keys:
hp
: total hit points (an integer)attack_bonus
: the attack bonus (an integer)special_abilities
: a list of strings for any special abilities acquired
0
Warrior
{"hp": 0, "attack_bonus": 0, "special_abilities": []}