以下是我的代碼:
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string s;
while(cin>>s && s!="#")
{
if(next_permutation(s.begin(),s.end()))
cout<<s<<endl;
else
cout<<"No Successor"<<endl;
}
return 0;
}
posted on 2011-04-15 16:14
lee1r 閱讀(333)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
題目分類:基礎(chǔ)/模擬 、
題目分類:遞推/遞歸