| ||||||||||
| 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 | |||||||||
终于知道了,是qsort函数的compare写错了。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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator