题目地址: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;
}


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-08-22
  • 2021-05-20
猜你喜欢
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-10-20
  • 2021-07-29
  • 2021-11-18
相关资源
相似解决方案