-->
当前位置:首页 > 题库

PROGRAMMING:The big guns hit the mosquitoes

Luz5年前 (2021-05-10)题库342
Now, we use cannons to shoot mosquitoes: mosquitoes are distributed on a two-dimensional plane of a $$m / times n $$lattice, with each mosquito occupying one lattice. If a shell is fired at any position of the plane, the killing range of the shell is as follows:
```
O
OXO
O
```
Among them, ` X 'is the center of the projectile's impact point, and ` O' is the four lethal grid areas close to the center. If the mosquito is hit by the shell (in the 'x' grid), it will be killed by one blow. If it is only killed (in the 'o' grid), it will lose half of its vitality. In other words, one hit or two kill can kill mosquitoes. Now we give the distribution of mosquitoes, the impact points of continuous' k 'shells, and the number of mosquitoes killed by each gun.
###Input format:
The first line contains two positive integers'm 'and' n 'no more than 20, with a space in the middle, indicating that there are'm' rows and 'n' columns in the two-dimensional plane.
Next, there are'm 'lines. Each line has' n' characters of '0' or '#' where '#' indicates that there are mosquitoes in the grid.
The next line contains a positive integer 'k' no more than 400, indicating the number of shells fired.
Finally, there are 'k' rows, each row contains the integer coordinates' x 'and' y 'of a shell (0 $$\ Le $$` X' $< $$$` m ', 0 $$\ Le $$` y' $< $$$` n '), separated by a space.
###Output format:
Corresponding to the input 'k' shell, the output has a total of 'k' lines, and the 'I' line is the number of mosquitoes killed by the 'I' shell.
###Input example:
```in
5 6
00#00#
000###
00#000
000000
00#000
two
1 2
1 4
```
###Output example:
```out
0
two
```






answer:If there is no answer, please comment