POJ 1731 Orders(STL运用)

题目地址:POJ 1731

这题能够直接用STL函数做,非常轻松。。next_permutation函数非常给力。。

代码例如以下:

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
using namespace std;
char s[300];
int main()
{
    int len, i, n;
    while(scanf("%s",s)!=EOF)
    {
        len=strlen(s);
        sort(s,s+len);
        puts(s);
        while(next_permutation(s,s+len))
        {
            puts(s);
        }
    }
    return 0;
}


原文地址:https://www.cnblogs.com/llguanli/p/6813041.html