Your weapon is kind of bad
Time limit1sMemory limit512 MB
Each fighter swaps to the other weapon bonus stats, recomputes combat power from the given formula, and reports whether it rises, falls, or stays the same.
- Level
Easy2 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
Kri and Pabu are playing a game that came out recently. The game shows how strong a character is with a single number called combat power. A character can equip only one weapon, and combat power goes up or down depending on which weapon is equipped, so players hunt for a good weapon to raise it.
One day the two of them ran into something odd. When you look at a piece of equipment you have not equipped, the game tells you how your combat power would change if you replaced your current equipment with it. Kri looked at Pabu's weapon and Pabu looked at Kri's weapon, and both times the game said the combat power would drop. Kri worked out that the formula for combat power is what causes this.
Five stats affect combat power: attack power, strength, critical chance, critical damage ratio, and attack speed bonus. Call those five stats , , , , in that order. The combat power is
The above means a critical chance of 100% or more counts as 100%.
You are given the five stats of Kri and Pabu with their weapons equipped, and the five stats that each of their current weapons adds. Subtracting what the equipped weapon adds gives the stats of that character with no weapon, and adding what another weapon gives yields the stats with that weapon equipped instead. Write a program that decides whether Kri's combat power rises, falls, or stays the same after equipping Pabu's weapon, and the same for Pabu equipping Kri's weapon.
Input
Each line holds five integers separated by spaces: attack power, strength, critical chance, critical damage ratio, and attack speed bonus, in that order.
The first line is Kri's stats with a weapon equipped, the second line is Pabu's stats with a weapon equipped, the third line is what Kri's current weapon adds, and the fourth line is what Pabu's current weapon adds.
Attack power and strength are between 0 and 20,000. Critical chance is between 0 and 200. Critical damage ratio and attack speed bonus are between 0 and 500. Critical chance, critical damage ratio, and attack speed bonus are all given in percent. For example, a critical chance given as 56 means an actual chance of 56%, that is 0.56. Each stat a weapon adds is at most the same stat of the character who has it equipped.
Output
On the first line, print how Kri's combat power changes after equipping Pabu's weapon. On the second line, print how Pabu's combat power changes after equipping Kri's weapon. Print + if it rises, - if it falls, and 0 if it stays the same.