5610: Problem D. Artifacts
[Creator : ]
Description
Genshin Impact is an open-world game by Mihoyo. As the main character, you were a pair of traveling twins, passing through countless worlds during your journey. Descending upon a continent named Teyvat, you hoped that you would be able to enjoy your time here. But as you awoke among the falling stars, you saw the world in turmoil, a cataclysm raging across the land...
You sought to leave this place and move on to the next world, but then an Unknown God stood before you, barring the way. This deity was spotless, floating over a world of chaos. Looking down on you. The god took your only kin away, and you were sealed and cast into a deep slumber filled with nightmares...
When you reawakened, the world was changed. The flames of war raged no longer, and nothing was left that looked familiar. How long had you been asleep? You had no answers.
Thus you began a lonely journey, seeking the deity that you had once laid eyes upon...
In this world, you can arm yourself with artifacts to enhance your strength. There are five kinds of artifacts in total: Flower of Life, Plume of Death, Sands of Eon, Goblet of Eonothem, Circlet of Logos. You can arm at most one artifact of each kind while you can choose to not wear some kinds of artifacts.
For each piece of artifacts, it has $5$ stat values. It is guaranteed that these stat values are of different types. There are $12$ kinds of stat value, including: HP, ATK, HP Rate, ATK Rate, DEF Rate, Physical DMG Rate, Elemental DMG Rate, Elemental Mastery, Energy Recharge Rate, Crit Rate, Crit DMG Rate, Healing Bonus Rate.
Here, we only care about ATK, ATK Rate, Crit DMG Rate, Crit Rate (the critical rate). You have $1500$ ATK initially, $5\%$ Crit Rate, $50\%$ Crit DMG Rate as the basis. With a total ATK Rate of $x\%$, ATK of $y$ while arming artifacts, the new ATK will become $1500\times(1+x)+y$. Then We can define the expected damage $E$ as
$$E=\ {ATK} \times (1-({Crit Rate}))+{ATK}\times (1+({Crit DMG Rate}))\times ({Crit Rate})$$
Specially, if Crit Rate exceeds $100\%$, it will be counted as $100\%$.
Now you are given $5$ artifacts, one piece per kind. You need to compute expected damage $E$ when you are armed with all these $5$ artifacts.
You sought to leave this place and move on to the next world, but then an Unknown God stood before you, barring the way. This deity was spotless, floating over a world of chaos. Looking down on you. The god took your only kin away, and you were sealed and cast into a deep slumber filled with nightmares...
When you reawakened, the world was changed. The flames of war raged no longer, and nothing was left that looked familiar. How long had you been asleep? You had no answers.
Thus you began a lonely journey, seeking the deity that you had once laid eyes upon...
In this world, you can arm yourself with artifacts to enhance your strength. There are five kinds of artifacts in total: Flower of Life, Plume of Death, Sands of Eon, Goblet of Eonothem, Circlet of Logos. You can arm at most one artifact of each kind while you can choose to not wear some kinds of artifacts.
For each piece of artifacts, it has $5$ stat values. It is guaranteed that these stat values are of different types. There are $12$ kinds of stat value, including: HP, ATK, HP Rate, ATK Rate, DEF Rate, Physical DMG Rate, Elemental DMG Rate, Elemental Mastery, Energy Recharge Rate, Crit Rate, Crit DMG Rate, Healing Bonus Rate.
Here, we only care about ATK, ATK Rate, Crit DMG Rate, Crit Rate (the critical rate). You have $1500$ ATK initially, $5\%$ Crit Rate, $50\%$ Crit DMG Rate as the basis. With a total ATK Rate of $x\%$, ATK of $y$ while arming artifacts, the new ATK will become $1500\times(1+x)+y$. Then We can define the expected damage $E$ as
$$E=\ {ATK} \times (1-({Crit Rate}))+{ATK}\times (1+({Crit DMG Rate}))\times ({Crit Rate})$$
Specially, if Crit Rate exceeds $100\%$, it will be counted as $100\%$.
Now you are given $5$ artifacts, one piece per kind. You need to compute expected damage $E$ when you are armed with all these $5$ artifacts.
Input
In the following $5\times 5$ lines, each $5$ lines describe an artifact. In each of $5$ lines, each line contains a string describing one of the five stat values.
For each stat value string, it will be given under the format of $''{typename+x}''$ or $''{typename+x\%}''$. $x$ is a non-negative real number of no more than $2$ decimals. We guarantee that the typename will be one of the $12$ types described before. When the typename equals to some Rate, there will be a $''{\%}''$ in the end and $x$ satisfies $0 \leq x \leq 100$. Otherwise, $x$ will be a real number in the range of $[0,\ 1,000]$.
For each stat value string, it will be given under the format of $''{typename+x}''$ or $''{typename+x\%}''$. $x$ is a non-negative real number of no more than $2$ decimals. We guarantee that the typename will be one of the $12$ types described before. When the typename equals to some Rate, there will be a $''{\%}''$ in the end and $x$ satisfies $0 \leq x \leq 100$. Otherwise, $x$ will be a real number in the range of $[0,\ 1,000]$.
Output
Output a real number indicating the answer. Your answer is acceptable if its absolute or relative error does not exceed $10^{-6}$.
Formally speaking, suppose that your output is $x$ and the jury's answer is $y$. Your output is accepted if and only if $\frac{|x - y|}{\max(1, |y|)} \leq 10^{-6}$.
Formally speaking, suppose that your output is $x$ and the jury's answer is $y$. Your output is accepted if and only if $\frac{|x - y|}{\max(1, |y|)} \leq 10^{-6}$.
Sample 1 Input
ATK+10.00
ATK Rate+10%
Crit Rate+10.00%
HP+10.00
DEF Rate+10.00%
Energy Recharge Rate+10.00%
ATK+10.00
Crit Rate+10.00%
Crit DMG Rate+10.00%
DEF Rate+10%
ATK+10.00
ATK Rate+10.00%
Elemental DMG Rate+10%
Crit DMG Rate+10.00%
Crit Rate+10.00%
Crit DMG Rate+10.00%
ATK Rate+10%
Healing Bonus Rate+10.00%
HP+10
DEF Rate+10.00%
ATK+10
ATK Rate+10%
HP Rate+10.00%
HP+10
DEF Rate+10.00%
Sample 1 Output
2739.2000000000