随笔 - 0  文章 - 5  trackbacks - 0
<2025年7月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

常用链接

留言簿(2)

文章分类

文章档案

教育

信息学奥赛

有用网站

在线OJ

专题测试

租房信息

搜索

  •  

最新评论

水题,不解释。
#include<fstream>
using namespace std;
const int N(10008);
struct pos_T
{
    
int x1,y1,a,b;
};
pos_T cpt[N];
bool can(int i,int x,int y)
{
    
if (x<cpt[i].x1||x>cpt[i].x1+cpt[i].a) return false;
    
if (y<cpt[i].y1||y>cpt[i].y1+cpt[i].b) return false;
    
return true;
}
int main()
{
    ifstream cin(
"carpet.in");
    ofstream cout(
"carpet.out");
    
int n,i,x,y;
    cin
>>n;
    
for (i=1;i<=n;i++)    
        cin
>>cpt[i].x1>>cpt[i].y1>>cpt[i].a>>cpt[i].b;        
    cin
>>x>>y;
    
for (i=n;i>=1;i--)
        
if (can(i,x,y)) break;
    
if (i<1) cout<<"-1"<<endl;
    
else cout<<i<<endl;
    cin.close();
    cout.close();
    
return 0;
}
posted on 2011-11-18 15:24 龙在江湖 阅读(517) 评论(0)  编辑 收藏 引用 所属分类: 竞赛题解_NOIP