51nod 1384:全排列(STL)
记住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)的更多相关文章
- 51 NOD 1384 全排列(STL 搜索)
1384 全排列 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出一个字符串S(可能又重复的字符),按照字典序 ...
- 51Nod 1384 全排列
给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列.例如:S = "1312", 输出为: 1123 1132 1213 1231 131 ...
- 51nod 1384 可重集的全排列
对于1231,121,111等有重复的数据,我们怎么做到生成全排列呢 实际上,对于打标记再释放标记的这种方法,如果一开始第一层递归访问过1那么你再访问 就会完全重复上一次1开头的情况,那么递归地考虑这 ...
- 用康托展开实现全排列(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)!+...+ ...
- 51Nod - 1384
全排列函数解法 #include <iostream> #include <cstdio> #include <cstring> #include <cmat ...
- 全排列 STL
#include<iostream> #include<algorithm> #include<stdio.h> using namespace std; int ...
- poj1256(全排列stl)
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;bool cmp ...
- 51Nod - 1384 正常解法
这个是正常解法 #include<stdio.h> #include<string.h> #include<math.h> #include<time.h&g ...
- 51Nod--1384全排列
1384 全排列 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出一个字符串S(可能又重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列.例 ...
随机推荐
- rownum的用法oracle
SELECT * FROM T WHERE ROWNUM=1 可以查询出来数据, 而SELECT * FROM T WHERE ROWNUM=2不可以查询出来数据. in the case of wh ...
- 阿里云code上传代码
1-从官网下载git,然后安装,这一步可以百度. 2-在阿里云上面创建project,如图 3-回到本地,进入本地代码文件目录,右击打开git 4-输入git init 在文件夹下面会出现.git文件 ...
- xiugai-去除js注释
<div class="myLoading"> <div class="svg-wrap"> <svg width="8 ...
- php面试专题---14、Linux基础考点
php面试专题---14.Linux基础考点 一.总结 一句话总结: php考linux其实也考不了很难 1.系统定时任务? crontab命令和 at命令 crontab命令 crontab -e ...
- Java中POI操作Excel常用方法
1. https://blog.csdn.net/yjt520557/article/details/82763785 2. https://blog.csdn.net/zxh66/article/d ...
- Java内置多线程框架Executor
JDK1.5之后,增加了一个Executor让我们能更好的使用多线程. 它位于java.util.concurrent包下 因为是JDK内置类库,我们不需要导入任何第三方jar包. 代码实例: imp ...
- 表单修饰符 number、trim、lazy
number修饰符 <input type="number" v-model.number="age"> 结论:age 类型则为number,非字符 ...
- 432D Prefixes and Suffixes
题目大意 给你一个串 对于一个子串如果它既是前缀又是后缀 输出它的长度以及它在原串中一共出现了多少次 分析 对于既是前缀又是后缀的判断和126B相同 然后我们只需要记录每个不同的z[i]出现了多少次 ...
- Linux 软件安装到哪里合适,目录详解
文章来源: https://blog.csdn.net/qq_22771739/article/details/83933473 Linux 的软件安装目录是也是有讲究的,理解这一点,在对系统管理是有 ...
- 鸿蒙系统开源学习经验分享HarmonyOS[www.allharmonyos.com]
分享鸿蒙系统开源知识,分享学习经验,分享鸿蒙系统开发经验 www.allharmonyos.com https://gitee.com/allharmonyos https://github.com/ ...