| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:弱就不要让全世界都知道了In Reply To:弱就不要让全世界都知道了 Posted by:frkstyc at 2006-07-30 16:52:24 #include<iostream.h>
struct point
{
int x,y;
point(){x=y=-1;}
};
struct win
{
int x1,y1,x2,y2;
win(){x1=x2=y1=y2=-1;}
};
bool judgement(point po,win wi)
{
if(po.x>=wi.x1&&po.y>=wi.y1&&po.x<=wi.x2&&po.y<=wi.y2)
return true;
else
return false;
}
int main()
{
int flag=0;
int flag2=0;
// int flag3;
int nwin=0,npoint=0;
cin>>nwin;
win * awin=new win[nwin];
for(int i=0;i<nwin;i++)
{
cin>>awin[i].x1;
cin>>awin[i].y1;
cin>>awin[i].x2;
cin>>awin[i].y2;
}
cin>>npoint;
point * apoint= new point[npoint];
for( i=0;i<npoint;i++)
{
cin>>apoint[i].x;
cin>>apoint[i].y;
}
cin>>flag2;
if(flag2==0)
{
for(i=0;i<npoint;i++)
{
flag=0;
for(int j=nwin-1;j>=0;j--)
{
if(judgement(apoint[i],awin[j]))
{
cout << j<<endl;
flag=1;
break;
}
}
if(flag==0)
{
cout<<-1<<endl;
}
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator