Get Many Persimmon Trees

#include #include #include #include #include #include #define MAX 102 using namespace std; int map[MAX][MAX]; int main(){ int m,w,h,s,t,x,y,i,j,p,k; while( ~scanf("%d",&m) && m ){ memset(map,0,sizeof(map)); scanf("%d%d",&w,&h); while( m-- ){ scanf("%d%d",&x,&y); map[x][y] = 1; } scanf("%d%d",&s,&t); int ans = 0,sum; for(i=1; i<=h-t+1; i++) for(p=1; p<=w-s+1; p++){ sum = 0; for(j=i; j<i+t; j++) for(k=p; k<p+s; k++)sum += map[k][j]; if( sum > ans ) ans = sum; } printf("%d\n",ans); } return 0; }

原文地址:https://www.cnblogs.com/xuwanghu/p/3008853.html