首页 > ACM题库 > HDU-杭电 > hdu 3312 Seashells待解决[解题报告]C++
2014
03-16

hdu 3312 Seashells待解决[解题报告]C++

Seashells

问题描述 :

Bob lived on an island which has many kinds of beautiful seashells. We can regard this island as a rectangular grid that is n rows by m columns. Assume that the coordinates of the j-th column of the i-th row is (i, j). The coordinates of Bob’s house is (x, y). There is at most one kind of seashells in each cell. Bob likes collecting seashells very much. However, he can only go the place of coordinates (x0, y0) with |x0-x|+|y0-y|<=A and max(|x0-x|, |y0-y|) <= B. How many kinds of seashells can Bob get at most?

输入:

The first line contains the number T of test cases (T<=5). The first line of each test cases contains four integer numbers n, m, x and y (1<=x<=n<=1000, 1<=y<=m<=1000). The following n lines each containing m integers indicating the type of the seashells. The seashells are different if and only if the corresponding integers are different. The next line contains a single integer q (q <= 105) indicating the number of queries. Each of the following q lines contains two integers A and B(0<=A,B<1000).

输出:

The first line contains the number T of test cases (T<=5). The first line of each test cases contains four integer numbers n, m, x and y (1<=x<=n<=1000, 1<=y<=m<=1000). The following n lines each containing m integers indicating the type of the seashells. The seashells are different if and only if the corresponding integers are different. The next line contains a single integer q (q <= 105) indicating the number of queries. Each of the following q lines contains two integers A and B(0<=A,B<1000).

样例输入:

1
4 4 1 2
1 2 3 4
3 2 1 4
5 3 2 654321
2 3 4 6
4
2 1
1 0
3 2
999 999

样例输出:

3
1
5
7


  1. 第2题,TCP不支持多播,多播和广播仅应用于UDP。所以B选项是不对的。第2题,TCP不支持多播,多播和广播仅应用于UDP。所以B选项是不对的。