2021 年东华大学金马程序设计联赛

B. Genshin Impact
PDF 题面可用
你可以在这里下载。

单点时限: 2.0 sec

内存限制: 256 MB

IDEA is currently playing the game Genshin Impact. She likes the character Ganyu very much, so she wants to increase Ganyu’s ATK as much as possible. Please help her. If you’ve ever played the Genshin Impact, please also read the problem carefully, because in this problem, there is something different with the game Genshin Impact.

IDEA use Ganyu of level 90, and has the following attributes:

Level Base Max HP Base ATK Base DEF Base CRIT DMG Base CRIT Rate
90 9797 335 630 38.4% 5%

The weapon used by Ganyu is Amos’ Bow. The Amos’ Bow has the following attributes:

Base ATK Percentage ATK Passive Skill
608 49.6% Increases Normal Attack and Charged Attack DMG by 12%.

In this problem, we only consider Ganyu’s charged attack. Ganyu’s charged attack deals two sections of damage:

  • In first section Ganyu fire off an Frostflake Arrow that deals Cryo damages.
  • In second section the Frostflake Arrow blooms after hitting opponents, dealing AoE Cryo damage.

The total damage of Ganyu’s charged attack are the sum of the damage of the Frostflake Arrow and the Frostflake Arrow Bloom. The percentage ATK bonus of the Frostflake Arrow is 230%, and the percentage ATK bonus of the Frostflake Arrow Bloom is 392%.

Let we assumed that Ganyu’s attack will always hit the target, and the two sections of damage are independent. Each section of damage will cause critical strike or not depends on the CRIT Rate. Since Ganyu is very powerful on her own, we are not considering the bonus damage from elemental reactions in this problem.

The damage calculate formula is following:

If there is no critical strike:

Damage=total ATK × percentage ATK bonus of character skills × (1+elemental DMG bonus + increased DMG)×(1- the resistance of monster) × ratio of damage taken by monsters

If there is critical strike:

Damage=total ATK × percentage ATK bonus of character skills × (1+elemental DMG bonus + increased DMG)×(1- the resistance of monster) ×ratio of damage taken by monsters × (1+CRIT DMG)

Now let we explain these parameters.

Total ATK

Total ATK = (character’s base ATK + weapon’s base ATK) × ( 1 + percentage ATK bonus) + numerical ATK bonus.
Note that the percentage ATK bonus is only provided by artifacts and weapons. Attention it that the percentage ATK bonus of character skills is not included in this part. The numerical ATK bonus only provided by artifacts.

Percentage ATK bonus of character skills

As mentioned above, the percentage ATK bonus of Frostflake Arrow is 230%, and the percentage ATK bonus of Frostflake Arrow Bloom is 392%.

Elemental DMG bonus

Elemental DMG bonus is only provided by artifacts, and only applies to attacks of the corresponding element.

Increased DMG

Increased DMG is provided by the Passive Skill of weapon or the effect of artifacts(such as “Wanderer’s Troupe” 4-piece set bonus)。

CRIT DMG

CRIT DMG is the sum of character’s base CRIT DMG and the CRIT DMG provided by weapon.

CRIT Rate

CRIT Rate is the sum of character’s base CRIT Rate and the CRIT Rate provided by weapon. If the CRIT Rate is exceeding 100%, we still assume it as 100%

Ratio of damage taken by monster

Ratio of damage taken by monsters = (the level of character + 100)/(the level of monster + the level of character + 200)

The resistance of monsters

Monsters have different resistance of different element. The Cryo element resistance of monsters in this problem is showed below.

The monster’s name Hilichurl Pyro_Whopperflower Cryo_Whopperflower Cryo_Slime
Cryo element resistance 10% 35% 75% 100%

The monsters in this problem have the following element affected states:
None, Pyro, Hydro, Dendro, Electro, Anemo, Cryo, Geo, Frozen.

Casting a Cryo attack of a monster in Hydro state will immediately change the monster into Frozen state and then deal to damage. Use Cryo attacks to monster in Frozen state will still keep monster in Frozen state. Use Cryo attacks to monster in other state will immediately change the monster into Cryo state and then deal to damage.

Artifacts

There are five kinds of artifacts in Genshin Impact for each part of the character:
Flower of Life, Plume of Death, Sands of Eon, Goblet of Eonothem, Circlet of Logos.

You can equip five parts of your character with these Artifacts, but remember that you can only equip only one Flower of Life , one Plume of Death, one Sands of Eon one Goblet of Eonothem and one Circlet of Logos. For example.you can’t equip two Flower of Life for your character.

There are multiple set of the Artifacts.
Equipping 2 or more items and 4 or more items in the same set of artifacts will trigger the set bonus. Each artifact exist 5 attributes. The possible attributes are following:

Numerical_HP_Bonus, Percentage_HP_Bonus, Numerical_ATK_Bonus, Percentage_ATK_Bonus, Numerical_DEF_Bonus, Percentage_DEF_Bonus, CRIT_DMG, CRIT_Rate, Pryo_ATK_Bonus, Cryo_ATK_Bonus, Hydro_ATK_Bonus, Electro_ATK_Bonus, Anemo_ATK_Bonus, Geo_ATK_Bonus, Elemental_Mastery, Energy_Recharge.

Except for the attributes that begin with “Numerical” and the Elemental Mastery, all attributes are percentage bonus.

In this problem, we only considerate following two sets of artifacts:

Wanderer’s Troupe

category Flower of Life Plume of Death Sands of Eon Goblet of Eonothem Circlet of Logos
name Troupe’s_Dawnlight Bard’s_Arrow_Feather Concert’s_Final_Hour Wanderer’s_String_Kettle Conductor’s_Top_Hat

2-piece set bonus: Increases Elemental Mastery by 80.

4-piece set bonus: Increases Charged Attack DMG by 35% if the character uses a Catalyst or a Bow.

Blizzard Strayer

category Flower of Life Plume of Death Sands of Eon Goblet of Eonothem Circlet of Logos
name Snowswept_Memory Icebreaker’s_Resolve Frozen_Homeland’s_Demise Frost-Weaved_Dignity Broken_Rime’s_Echo

2-piece set bonus: Cryo DMG Bonus +15%

4-piece set bonus: When a character attacks an opponent affected by Cryo, their CRIT Rate is increased by 20%. If the opponent is Frozen, CRIT Rate is increased by an additional 20%.

In each test case, give you some artifacts and tell you what monster Ganyu faced, please calculate the expected damage for a charged attack.

Promised that the artifacts in input data are legal.

输入格式

There are multiple test cases.

For each test case:

The first line contains a integer $n(n\leq 5)$, denoting the number of artifacts.

The second line contains a string indicate the monster name.

The third line contains a integer $l(1\leq l\leq 120)$ indicate the monster level.

The fourth line contains string indicate the monster state.

Then for each artifact, first give you the artifact’s name in one line.

Then for the next 5 lines, each line begin with a string denoting the attribute of the artifact, then following one integer $x(x\leq 10000)$, denoting the bonus of this attribute. If the attribute is percentage bonus, $x$ indicates the real bonus multiply $1000$(For example, if the attribute is CRIT Rate increased by 20%, than the value in input data is 200).

The number of test cases is less than $10^5$。

输出格式

For each test case, print the value of expected damage for a charged attack in one line. Round up to integer.

样例

Input
5
Hilichurl
81
Anemo
Snowswept_Memory
Numerical_HP_Bonus 4780
Numerical_DEF_Bonus 44
Percentage_ATK_Bonus 82
CRIT_Rate 62
CRIT_DMG 132
Icebreaker's_Resolve
Numerical_ATK_Bonus 311
Elemental_Mastery 23
CRIT_DMG 272
Numerical_HP_Bonus 448
Percentage_ATK_Bonus 58
Frozen_Homeland's_Demise
Percentage_ATK_Bonus 466
Percentage_DEF_Bonus 117
Elemental_Mastery 175
CRIT_Rate 66
Numerical_ATK_Bonus 24
Frost-Weaved_Dignity
Cryo_ATK_Bonus 466
Numerical_ATK_Bonus 18
CRIT_DMG 140
Percentage_DEF_Bonus 131
Percentage_HP_Bonus 204
Broken_Rime's_Echo
CRIT_DMG 622
Percentage_ATK_Bonus 117
Numerical_DEF_Bonus 42
Numerical_HP_Bonus 299
Numerical_ATK_Bonus 53
Output
19721