码迷,mamicode.com
首页 > 其他好文 > 详细

51Nod 1384 全排列

时间:2018-02-17 12:35:52      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:col   51nod   ble   post   main   lan   blank   algorithm   string   

题目:https://vjudge.net/problem/51Nod-1384

主要是排序+生成全排列,练习一下sort next_permutation两个函数。注意头文件都是<algorithm>.

strlen头文件<cstring>,勿漏。

#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int main(){

    char str[15];
    scanf("%s",str);
    int len=strlen(str);
    sort(str,str+len);
    printf("%s\n",str);
    while(next_permutation(str,str+len)){
        printf("%s\n",str);
    }

    return 0;
}

 

51Nod 1384 全排列

标签:col   51nod   ble   post   main   lan   blank   algorithm   string   

原文地址:https://www.cnblogs.com/travelller/p/8451678.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!