uva146(简单题)-全排列

来源:互联网 发布:手机防丢失软件 编辑:程序博客网 时间:2024/06/05 18:40
next_permutation(,)只能说这个函数尊的很好用,必备
#include <iostream>
#include <algorithm>#include <cstring>using namespace std;int main() {char str[100];while (cin >> str&&str[0]!='#') {int len = strlen(str);if (next_permutation(str, str + len))cout << str << endl;elsecout <<"No Successor"<< endl;}return 0;}
0 0
原创粉丝点击