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

为什么这样写在这里通不过啊!!!用VC++可以通过的 1007 DNA Sorting

Posted by 10101526 at 2011-11-02 23:56:25
#include<iostream>
#include<vector>
#include<string> 
using namespace std;
int main()
{
	vector<string> v;
	vector<int> u(6,0);
	string s;
	int w1,x1;
	cin>>w1>>x1;
	for(int i=0;i<x1;i++)
	{
		cin>>s;
		v.push_back(s);
	}
	for(int w=0;w<x1;w++)
		for(int i=0;i<w1;i++)
			for(int j=i;j<w1;j++)
				if(v[w][j]<v[w][i]) u[w]++;				
	for(int y=1;y<x1;y++)
		for(int t=0;t<x1-y;t++)
			if(u[t]>u[t+1])
			{
				int temp;
				temp=u[t];
				u[t]=u[t+1];
				u[t+1]=temp;
				v[t].swap(v[t+1]);			
			}
	for(int m=0;m<x1;m++)		
		cout<<v[m]<<endl;
	return 0;
}

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