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 |
求解释!搞不懂呀搞不懂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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator