题目链接

记住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. mybatis获取数据库自增id

    http://blog.csdn.net/dyllove98/article/details/8866357 http://www.iteye.com/problems/86864 insert标签中 ...

  2. MySQL工作中遇到的问题记录

    1:log_slave_updates: 从库1搭建级联从库2,从库1需要开启log_slave_updates,修改/etc/my.cnf,增加一行log_slave_updates=1,重启数据库 ...

  3. pve之daemon

    pmxcfs The Proxmox Cluster file system (“pmxcfs”) is a database-driven file system for storing confi ...

  4. redhat 修改yum源

    问题现象: 现有的yum安装git失败,提示yum源连接失败 Error Downloading Packages: git--.el6_4..x86_64: failure: Packages/gi ...

  5. zookeeper分布式锁用法

    package com.example.demo3.zk; import lombok.extern.slf4j.Slf4j; import org.apache.storm.shade.org.ap ...

  6. 使用 Select2 下拉框实现复选

    使用 Select2 下拉框实现复选 <!DOCTYPE html> <html> <head> <meta http-equiv="Content ...

  7. windows 命令端口映射

    显示映射列表netsh interface portproxy show all 将本地的1234端口的数据转发至192.168.x.x上的1234端口netsh interface portprox ...

  8. 测开之路七十九:python 文件处理和对象的写入读取

    """处理文件:open(文件名, 模式,编码) 'r' 打开阅读(默认)'w' 打开写入,首先截断文件'x' 打开独占创建,如果文件已经存在则失败'a' 打开写入,追加 ...

  9. time in china

    https://www.timeanddate.com/worldclock/china

  10. (转载) linux下文件权限设置中的数字表示

    chmod ABC file 其中A.B.C各为一个数字,分别表示User.Group.及Other的权限. A.B.C这三个数字如果各自转换成由“0”.“1”组成的二进制数,则二进制数的每一位分别代 ...