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

终于知道了,是qsort函数的compare写错了。

Posted by piaolingqingsi at 2008-04-05 15:09:10 on Problem 1468
In Reply To:在搜索之前先对矩形进行排序,不过WA了,实在想不到错在哪里,望指教! Posted by:piaolingqingsi at 2008-04-01 09:16:19
把cmp改成这样就过了。

int cmp(const void* a, const void* b){
	
	struct rect *c = (struct rect *)a;
	struct rect *d = (struct rect *)b;
	if(c->x1 != d->x1) return (d->x1)-(c->x1);
	else if( c->x2 != d->x2 ) return (c->x2)-(d->x2);
	else if( c->y1 != d->y1 ) return (d->y1)-(c->y1);
	else  return (c->y2)-(d->y2);
}

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