zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    App Submission Issues
    番茄钟App(Pomodoro Tracker)
    WatchKit App Submission Issues
    Watch​Kit Learning Resources
    Scrum Planning Card
    How to get cocoapods work on Yosemite
    如何在DigitalOcean安装Ghost
    Swift学习资源
    Xcode 6 模拟器路径
    【Android-4】Scheme跳转协议
  • 原文地址:https://www.cnblogs.com/lvpengms/p/1662773.html
Copyright © 2011-2022 走看看