Overkill
Time limit0.5sMemory limit1024 MB
Count the turns needed to kill all monsters when each turn deals D damage and passes p percent of any overkill to the next monster.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation
- Solved
- No attempts yet
Problem
cologne is playing a game called Trimps. The game has monsters lined up in order. The current health of the -th monster is . Dealing damage to a monster reduces its health by , and if its health drops to or below, the monster dies. cologne's goal is to kill every monster through battle. A battle consists of several turns, and each turn works as follows. 1. Find the first monster whose health is above and deal damage to it. 2. If the damaged monster's health becomes , which is below , overkill happens. Overkill is handled as follows. If the damaged monster has no next monster, the turn ends. If a next monster exists, deal damage equal to percent of , rounded down to an integer, to the next monster. How many turns are needed to kill all monsters?
Input
The first line contains the number of monsters , the base damage , and the overkill ratio , separated by spaces. The next lines contain the health values of each monster, separated by spaces. All given numbers are integers.
Output
Print the number of turns needed to kill all monsters.
Hint
Overkill happens only once per turn. In other words, one turn cannot deal damage to three or more monsters.