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

又是WA,大虾们救我!!!!!

Posted by 904013041 at 2004-12-31 13:56:38 on Problem 1007
#include <stdio.h>
#include <string.h>
void main(){
	char string[101][51],letter[3]={'C','G','T'},letters[101];
	long int count[101]={0},tem=0;
	int n,m,j,k,i,h,l;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){		
		scanf("%s",string[i]);
		for(k=0;k<3;k++){
			for(j=0;j<n;j++){
				if(letter[k]==string[i][j]){
					for(h=j+1;h<n;h++){
						if(letter[k]>string[i][h])
							count[i]++;
					}
					break;
				}
			}
		}
	}
	for(i=0;i<m-1;i++){
		for(l=0;l<m-i-1;l++){
			if(count[l]>count[l+1]){
				tem=count[l];
				count[l]=count[l+1];
				count[l+1]=tem;
				strcpy(letters,string[l]);
				strcpy(string[l],string[l+1]);
				strcpy(string[l+1],letters);
			}
		}
	}
	for(i=0;i<m;i++)
		printf("%s\n",string[i]);
}


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