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

为什么老是runtime error,帮忙看看

Posted by phtniit at 2010-12-12 15:28:13 on Problem 1007
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef multimap<  int,int,less<int> >MID;
int main()
{
	int m,n;
	cin>>m>>n;
	vector<vector<char> >one(n, vector<char>(m));
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			cin>>one[i][j];
	int *two=new int(n);
	for(int i=0;i<n;i++)two[i]=0;
	for(int k=0;k<n;k++)
	{
		for(int i=0;i<m;i++)
			for(int j=i;j<m;j++)
				if(one[k][j]<one[k][i])two[k]++;}
	MID pairs;
	for(int i=0;i<n;i++)
		pairs.insert(MID::value_type(two[i],i) );
	for(MID::iterator i=pairs.begin();i!=pairs.end();i++){
		for(int j=0;j<m;j++)cout<<one[i->second][j];
		cout<<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