题目大意:给你一个矩阵,矩阵上面有N个柿子树,现在要求你画一个s*t的矩阵,使得这个矩阵内的柿子树达到最多

解题思路:100 * 100,直接暴力

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 110;

int n, w, h, s, t;
int map[N][N];

void init() {
    scanf("%d%d", &w, &h);
    memset(map, 0, sizeof(map));

    int x, y;
    for (int i = 0; i < n; i++) {
        scanf("%d%d", &x, &y);
        map[x][y] = 1;
    }
    scanf("%d%d", &s, &t);
}

void solve() {
    int ans = 0;

    for (int i = 1; i + s - 1 <= w; i++)
        for (int j = 1; j + t - 1 <= h; j++) {
            int cnt = 0;
            for (int k = i; k < i + s; k++)
                for (int l = j; l < j + t; l++)
                    if (map[k][l]) cnt++;
            ans = max(cnt, ans);
        }
    printf("%d\n", ans);
}

int main() {
    while (scanf("%d", &n) != EOF && n) {
        init();
        solve();
    }
    return 0;
}