| ||||||||||
| 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 | |||||||||
Re:库函数几乎不可能出错的In Reply To:Re:库函数几乎不可能出错的 Posted by:OOOOOOOO at 2006-01-05 10:55:35 > 难道是我代码的问题!?
> 下面是我程序中的相关代码。
> 用A C G T四个单字符序列测试
> 排序前输出顺序为A C G T,且逆序全部为0
> 排序后输出顺序为C G T A,
> 可以重复。
>
> char aa[100][50+1];
> struct item {
> int inversions;
> int idx;
> } rec[100];
>
> for(i=0;i<m;++i) {
> printf("%s\n",aa[rec[i].idx]);
> printf("%d\n",rec[i].inversions);
> }
>
> qsort(rec,m,sizeof(struct item),sort_func);//qsort好像会破坏原来的顺序,test case:1 4 A C G T;
>
> for(i=0;i<m;++i) {
> printf("%s\n",aa[rec[i].idx]);
> }
你的sort_func函数一定写错了。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator