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 xcl119xcl at 2007-07-28 22:28:26 on Problem 1731
#include <iostream>
#include <string>
#include <algorithm>
 
using namespace std;

int main()
{
	string str;
	while(cin>>str)
	{
		sort(&str[0],&str[0]+str.length());//先排序
		cout<<str<<endl;//输出排序后的
		while(next_permutation(&str[0],&str[0]+str.length()))
		{
			cout<<str<<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