| ||||||||||
| 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注意点因为qsort返回值为int 类型,所以不能用 return *a-*b!!这样子精度不够!
可以写int cmp(const void* _a,const void* _b)
{
double *a=(double*)_a;
double *b=(double*)_b;
if(a[0]-b[0]<0) return -1;
else if(a[0]==b[0]) return 0;
else return 1;
}
不可以写
int cmp(const void* _a,const void* _b)
{
double *a=(double*)_a;
double *b=(double*)_b;
return (int )*a-*b;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator