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

求解释!搞不懂呀搞不懂

Posted by 20082971 at 2012-12-04 23:59:19 on Problem 2002
int find(int x,int y,int left,int right,node* a)
{
	int mid;
	if(left>right)
		return -1;
	mid = (left+right)/2;
	if(a[mid].x>x)
		find(x,y,left,mid-1,a);
	else if(a[mid].x<x)
		find(x,y,mid+1,right,a);
	else
	{
		if(a[mid].y>y)
			find(x,y,left,mid-1,a);
		else if(a[mid].y<y)
			find(x,y,mid+1,right,a);
		else
			return mid;
	}
}
在写二分的时候,原来是int find(double x,double y,int left,int right,node* a),就是WA,后来改成了int find(int x,int y,int left,int right,node* a),就AC了,跪求大神指出错误!!!

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