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 |
郁闷了。。。#include <iostream> using namespace std; void Sort(long int log[100],int index[100],int m) { bool novisited[100]; long int key=0;int p=0,l=0; while(p<m) { while(!novisited[p]){p++;} key=log[p]; int temp=p; for(int q=0;q<m;q++) { if(novisited[q]&&log[q]<key) { //if(log[q]==key&&temp!=q); //else {} temp=q;key=log[q]; } } index[l]=temp; l++; //cout<<"INDEX"<<p<<"="<<index[p]<<endl; novisited[temp]=false; } } void input(int n,int m) { char date[100][50]; long int log[100]={0}; int index[100]; char ch; for (int i=0;i<m;i++) { long int lenA=0,lenC=0,lenG=0,lenT=0; for(int j=0;j<n;j++) { cin>>ch; date[i][j]=ch; switch(ch) { case 'A' : log[i]=log[i]+lenG+lenC+lenT; lenA++; break; case 'C': log[i]=log[i]+lenG+lenT; lenC++; break; case 'G': log[i]=log[i]+lenT; lenG++; break; case 'T': lenT++; } } //cout<<log[i]; } Sort(log,index,m); for (int u=0;u<m;u++) { //cout<<index[u]<<endl; //string s=""; for(int v=0;v<n;v++) { cout<<date[(index[u])][v]; } cout<<endl; } return; } int main() { int n,m; while(cin>>n>>m) input(n,m); return 0; } 狂WA... Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator