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");
    }
}

arrow
arrow
    創作者介紹
    創作者 尾玉 的頭像
    尾玉

    louisfghbvc的部落格

    尾玉 發表在 痞客邦 留言(0) 人氣()