Peng Lv

毋意,毋必,毋固,毋我。 言必行,行必果。

导航

POJ 2029 Get Many Persimmon Trees

//这题应该用树状数组做,可是第一眼看,想都没想就搜了...

 

#include<iostream>
using namespace std;

int main()
{
    
int a[1110][2],i,j,k,w,h,s,t,n,temp,max;
    
while(1)
    {
        scanf(
"%d",&n);
        
if(n==0break;
        max
=-100;
        scanf(
"%d%d",&w,&h);
        
for(i=0;i<n;++i)
            scanf(
"%d%d",&a[i][0],&a[i][1]);
        scanf(
"%d%d",&s,&t);
        
for(i=0;i<w;++i)
            
for(j=0;j<h;++j)
            {
                
if(i+s-1<=w&&j+t-1<=h)
                {
                    temp
=0;
                    
for(k=0;k<n;++k)
                        
if(a[k][0]>=i+1&&a[k][0]<=i+s&&a[k][1]>=j+1&&a[k][1]<=j+t)
                        
++temp;
                    
if(temp>max) max=temp;
                }

            }
        printf(
"%d\n",max);
    }
    
return 1;
}

 

 

posted on 2010-02-03 16:32  Lvpengms  阅读(454)  评论(0编辑  收藏  举报