Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:弱就不要让全世界都知道了

Posted by lcz at 2009-05-02 17:03:29 on Problem 1350
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator