6.9 algorithm头文件下常用函数介绍

6.9 algorithm头文件下常用函数介绍

http://codeup.hustoj.com/contest.php?cid=100000604

B 全排列

题目解析

⚠️next_permutation不能对string使用,可对char使用

代码

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main() {
    char a[10];
    while (gets(a)) {
        do {
            printf("%s\n",a);
        } while (next_permutation(a, a + strlen(a)));
        printf("\n");
    }
    return 0;
}
posted @ 2021-03-17 00:01  Joey-Wang  阅读(63)  评论(0)    收藏  举报