import java.io.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
static int n,m,k,t,result;
public static void main(String[] args) throws IOException{
int x,y;
String[] str;
str = br.readLine().split(" ");
n = Integer.parseInt(str[0]);
m = Integer.parseInt(str[1]);
k = Integer.parseInt(str[2]);
t = Integer.parseInt(str[3]);
result = 0;
for(int i = 0 ; i < k ; i++){
str = br.readLine().split(" ");
x = Integer.parseInt(str[0]);
y = Integer.parseInt(str[1]);
Boom(x , y);
}
out.write(result + "");
out.flush();
out.close();
br.close();
}
public static void Boom(int x , int y){
int answer = 0;
for(int i = (Math.max(1, x - t)) ; i <= (Math.min(n , x + t)) ; i++){
for(int j = (Math.max(1 , y - t)) ; j <= Math.min(m , y + t) ; j++){
if(Distance(i , j , x , y)){
answer++;
}
}
}
result = Math.max(result , answer);
}
public static boolean Distance(int i , int j , int x , int y){
return Math.sqrt(Math.pow(x - i, 2) + Math.pow(y - j, 2)) <= t;
}
}
洛谷 P2074 危险区域 Java
最新推荐文章于 2024-09-20 15:32:13 发布