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包括的字符组成的所有排列.例 ...
随机推荐
- php二维数组对某一列进行数据组装
demo示例: $data = array( '0' => array('id' => 10, 'username' => '陈一'), '1' => array('id' = ...
- 如何查看MySQL数据库的版本
如何查看MySQL数据库的版本 一.总结 一句话总结: SQL语句:select version(); 命令行:mysql -V 或 mysql --version 二.三种方法查看MySQL数据库的 ...
- WebGIS常用代码集锦
一.普通代码 1.坐标转换 ol.proj.transform(coordinate, source, destination) ol.proj.transform(coordinate, 'EPSG ...
- EZOJ #374学习
分析 二分天数 暴力判断即可 代码 #include<bits/stdc++.h> using namespace std; #define int long long ],b[],c[] ...
- 16/8/21_PHP-有关类函数,this,static,面向对象思想介绍
class_exists():判断某个类是否存在(定义过) interface_existe():判断接口是否存在 get_class():获取某个对象的"所属类名" get_pa ...
- vlan trunk配置
vlan trunk配置 Trunk:中继干道 作用:一条链路能承载多个vlan的流量,并对不同vlan的流量进行不同标记 trunk能够使vlan跨越交换机 PT配置 配置vlan:两台交换机同样的 ...
- Vue动态添加响应式属性
不能给Vue实例.Vue实例的根数据对象添加属性. 文件 <template> <div id="app"> <h2>{{hello}}:{{a ...
- 7、numpy——广播
1.广播的引出 广播(Broadcast)是 numpy 对不同形状(shape)的数组进行数值计算的方式, 对数组的算术运算通常在相应的元素上进行. 如果两个数组 a 和 b 形状相同,即满足 a. ...
- ubuntu 系统类似QQ截图工具:DeepinScrot,flameshot
经过一番探索! Ubuntu16.04 就用DeepinScrot 好用!不支持flameshot,反正我是半天没装成功 教程:https://blog.csdn.net/qq_19339041/ar ...
- 无法删除VMware旧版本,请与技术小组联系
问题:把文件夹清理了n遍,却无法重装VMware,报错如标题. 原因:相关注册表没删完. 解决办法: - 1.创建一个.txt文本 - 2.将下面的内容复制到.txt文本中: echo off cls ...