POJ 1731

作者: vanadia | 来源:发表于2016-08-31 21:09 被阅读0次

    POJ 1731

    题意

    求全排列

    思路

    直接调用next_premutation函数。

    #include <iostream>
    #include <string>
    #include <algorithm>
    
    using namespace std;
    
    int main(int argc, char const *argv[])
    {
        string str;
        while(cin>>str){
            sort(str.begin(),str.end());
            cout<<str<<endl;
            while(next_permutation(str.begin(), str.end()))
                cout<<str<<endl;
        }
        return 0;
    }
    

    相关文章

      网友评论

          本文标题:POJ 1731

          本文链接:https://www.haomeiwen.com/subject/dckcettx.html