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> #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator