POJ1146第一次用next_permutation()

来源:互联网 发布:ghostscript知乎 编辑:程序博客网 时间:2024/06/05 14:20
#include <iostream>#include <string.h>#include <algorithm>#include <string>using namespace std;int main(){char str[60];int len;while(cin>>str){if(str[0]=='#')break; len=strlen(str); bool sorting=next_permutation(str,str+len); if(!sorting) cout<<"No Successor"<<endl; else cout<<str<<endl;}return 0;}

0 0