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

有没有人帮我看看??

Posted by lanxisha at 2005-08-24 23:24:12
In Reply To:请教高手1007? Posted by:lanxisha at 2005-08-24 22:38:09
> 我的程序显示错误为:RUNTIME ERROR
> 什么原因呢?
> 如下:
> 
> #include<iostream>
> #include<string>
> #include<vector>
> using namespace std;
> 
> typedef vector<int> vint;
> typedef vector<string> vstr;
> 
> int sort(string s){
> 	int result=0;
> 	for(int i=0;i<s.length();i++)
> 		for(int j=i;j<s.length();j++)
> 			if(s[i]>s[j])result++;
> 
> 	return result;
> }
> 
> int main(){
> 	int num,lenth;
> 	string str;
> 	vint sortness;
> 	vstr s;
> 	cin>>lenth>>num;
> 	for(int i=0;i<num;i++){
> 		cin>>str;
> 		s.push_back(str);
> 		sortness.push_back(sort(s[i]));
> 	}
> 	
> 	for(int m=0;m<num;m++)
> 		for(int n=m+1;n<num;n++){
> 			string temp;
> 			int temp2;
> 		
> 			if(sortness[m]>sortness[n]){
> 				temp=s[m];
> 				s[m]=s[n];
> 				s[n]=temp;
> 
> 				temp2=sortness[m];
> 				sortness[m]=sortness[n];
> 				sortness[n]=temp2;
> 			}
> 
> 		}
>     
> 	for(int k=0;k<s.size();k++)
> 		cout<<s[k]<<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