题目链接

记住next_permutation函数的用法,另外string在这里比char[]慢好多啊。。

//#include<bits/stdc++.h>
//using namespace std;
//typedef long long LL;
//
//int main()
//{
//    string s;
//    while(cin>>s)
//    {
//        int l=s.length();
//        sort(s.begin(),s.end());
//        do
//        {
//            cout<<s<<endl;
//        }while(next_permutation(s.begin(),s.end()));
//    }
//}            //437ms  1888KB

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int main()
{
    ];
    while(~scanf("%s",s))
    {
        int l=strlen(s);
        sort(s,s+l);
        do
        {
            puts(s);
        }while(next_permutation(s,s+l));
    }
}            //78ms  1872KB

51nod 1384:全排列(STL)的更多相关文章

  1. 51 NOD 1384 全排列(STL 搜索)

    1384 全排列       基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题        收藏        关注   给出一个字符串S(可能又重复的字符),按照字典序 ...

  2. 51Nod 1384 全排列

    给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列.例如:S = "1312", 输出为:   1123 1132 1213 1231 131 ...

  3. 51nod 1384 可重集的全排列

    对于1231,121,111等有重复的数据,我们怎么做到生成全排列呢 实际上,对于打标记再释放标记的这种方法,如果一开始第一层递归访问过1那么你再访问 就会完全重复上一次1开头的情况,那么递归地考虑这 ...

  4. 用康托展开实现全排列(STL、itertools)

    康拓展开: $X=a_n*(n-1)!+a_{n-1}*(n-2)!+\ldots +a_2*1!+a_1*0!$ X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+ ...

  5. 51Nod - 1384

    全排列函数解法 #include <iostream> #include <cstdio> #include <cstring> #include <cmat ...

  6. 全排列 STL

    #include<iostream> #include<algorithm> #include<stdio.h> using namespace std; int ...

  7. poj1256(全排列stl)

    #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;bool cmp ...

  8. 51Nod - 1384 正常解法

    这个是正常解法 #include<stdio.h> #include<string.h> #include<math.h> #include<time.h&g ...

  9. 51Nod--1384全排列

    1384 全排列 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出一个字符串S(可能又重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列.例 ...

随机推荐

  1. django缓存优化(二)

    一.缓存目的: 1.减小过载 2.避免重复计算 3.提高系统性能 二.如何进行缓存 三.缓存类型 四.缓存粒度分类 五.缓存的设置与使用 示例一: CACHES = { 'default': { 'B ...

  2. 2017数据科学报告:机器学习工程师年薪最高,Python最常用

    2017数据科学报告:机器学习工程师年薪最高,Python最常用 2017-11-03 11:05 数据平台 Kaggle 近日发布了2017 机器学习及数据科学调查报告,针对最受欢迎的编程语言.不同 ...

  3. scrapy--meta参数传递问题

    scrapy使用大坑---meta参数传递出现之重复问题 问题描述: 爬虫目标: 实现哔哩哔哩网站的视频信息爬取,只要的信息结构爬去顺序为**关键词的搜索结果,拿到第一页上某个视频的标题,url,和时 ...

  4. 牛客提高D6t3 分班问题

    分析 就就就是推柿子 看官方题解吧/px 代码 #include<iostream> #include<cstdio> #include<cstring> #inc ...

  5. anki2.1中使用latex,使用 MathJax 渲染latex格式的数学公式,化学公式

    说说mathJax的优点: 不在anki媒体库生成图片,有利于节约手机空间. 再说说它的缺点:需要学习latex,需要一些时间去掌握latex语法. 1.去MathJax的github下载源码包 2. ...

  6. State Hook

    1 useState函数的第一个参数,是state变量的初始值. 2 每次渲染时,多个State Hook的顺序.数量都是一样的.(不能多.不能少) 3 state变量是只读的 4 state变量发生 ...

  7. JS基础(下)

    事件DOM Event 更多事件请查询h3c  htmldom参考手册  event onclick() :当点击时 onfocus() :获得焦点时 :当点击某个区域时触发,如点击输入框 onblu ...

  8. 2019/11/02 TZOJ

    1001 ShaoLin http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6003 标记一下i ...

  9. vsphere虚拟化之 NTP服务的创建(三)

    1.先修改windows 2012的注册表. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\ 设置 Annou ...

  10. 学习ECMAScript标准和具体实现-JavaScript

    在NDN的JavaScript Guide里,Array和Map,Set都属于collections of data.它们的区别就是,Array是ordered by an index value,  ...