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

Re:库函数几乎不可能出错的

Posted by OOOOOOOO at 2006-01-05 10:55:35 on Problem 1007
In Reply To:库函数几乎不可能出错的 Posted by:frkstyc at 2006-01-04 23:06: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]);
	}

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