|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
Killbots is a simple game of evading killer robots. Who created the robots and why they have been programmed to destroy, no one knows. All that is know is that the robots are numerous and their sole objective is to destroy everything on their way. Fortunately, their creator focused on quantity rather than quality and as a result the robots are severely lacking in intelligence. Killbots is a turn-based game, played on a rectangular grid. Each cell can contain one of the following:
The following figure is an example of how the game works. The cell E5 is where the hero stands. The cells containing junkheap are marked with '*'. Robots and fastbots are shown with '+' and '#' respectively. If we start from the grid on the left, the robots at B5 an E4 take direct steps directly towards the hero (to the right and down respectively). The latter is destroyed by the hero. The one at B8 takes an up-right step to C7. The robot at H6 takes an up-left step to G5 where it crashes into junkheap and is destroyed. The robot at F7 toes to E6 (where it will be destroyed in the next step by the fastbot initially at G8. Note that all robots and fastbots move simultaneously so at the same time F7 moves to E6, the fastbot at G8 move to F7, without collision. After a turn that all robots a fastbots move, the fastbots move another step while the robots stay. So, the fastbot at F7 moves to E6 crashing into the robot staying there. They are both destroyed leaving junkheap at E6. The game continue until all robots and fastbots are destroyed either by the hero, or crashing into other robots or junkheap.
The goal of this problem is count the number of robots and fastbots destroyed by the hero.
There are multiple test-case in the input each specifying a game grid. Each test case contains several lines of the same length. Each line describes a row of the grid, and each character of the line is a cell of the grid. Empty cells are marked by '.', and non-empty cells are marked by the special characters described in the problem description. Af each test-case, there is a line in the input containing a single '\$' character. You may assume there is one and only one cell in the input containing '@'. Each side of the grid has at least one and at most 1000 cells.
For each test case, write a single line containing the number of fastbots and robots destroyed by the hero when the game ends (after all robots and fastbots are destroyed).
...*.... .......# .....*.. ....+... .+..@.*. .......+ .*...+.. .+....#. $ ... ..@ .*. .+. $