Shirlies
宁静专注认真的程序媛~

感触:STL真好用~~~

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
 char s[60];

 cin>>s;
 while(s[0]!='#')
 {
  int len=strlen(s);
  if(next_permutation(s,s+len))
  {
   cout<<s<<endl;
  }
  else
  {
   cout<<"No Successor"<<endl;
  }

  cin>>s;
 }

 return 0;
}

“下一个排列”next_permutation()

posted on 2012-02-05 17:47  Shirlies  阅读(218)  评论(0编辑  收藏  举报