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 |
又是WA,大虾们救我!!!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator