20180409 알고리즘 문제 문제출처: https://www.acmicpc.net/problem/14195
문제 The new DotA game is coming out soon. All the fans around the world are waiting to try the new version of DotA: ”DotB”.
There’s a lot of pressure on the developers of the game to add new heroes to it. They come up with ideas but not all of them are worth implementing. For one particular hero they are working on, they asked you to write a program to analyze one of its abilities. The hero’s name is ”Cave Man”, and his ability is to summon a crow to attack a line of enemies.
The line has n enemies with hitpoint h1h2...hn. The crow always starts at the first enemy and attacks each one and goes to the next. It attacks exactly n + 5 times in total, and if it reaches the end of the line, it continues the attack from the other end of the line.