close
題目連結: https://onlinejudge.org/external/1/146.pdf
題目大意: 找下一個排列組合。
思路: 利用STL 函式庫的排列組合。
代碼:
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
while(getline(cin, s), s != "#"){
bool ok = 0;
if(next_permutation(s.begin(), s.end())){
ok = 1;
}
if(ok) cout << s << endl;
else puts("No Successor");
}
}
文章標籤
全站熱搜