字典序
来源:互联网 发布:linux中dns配置文件 编辑:程序博客网 时间:2024/06/05 15:32
#include<iostream>
#include<algorithm>
#include<string.h>
int
a[6],n;
bool
b[6];
using
namespace
std;
int
main()
{
void
pp(
int
);
while
(cin>>n)
{
memset
(b,
false
,
sizeof
(b));
memset
(a,0,
sizeof
(a));
pp(1);
}
return
0;
}
void
pp(
int
k)
{
for
(
int
i=1;i<=n;i++)
{
if
(b[i]==
false
)
{
a[k]=i;b[i]=
true
;
if
(k==n)
{
for
(
int
j=1;j<=n;j++)
{
if
(j==n) cout<<a[j]<<endl;
else
cout<<a[j]<<
' '
;
}
b[i]=
false
;
return
;
}
pp(k+1);
b[i]=
false
;
}
}
}
阅读全文
0 0
- 字典序
- 字典序
- 字典序
- 字典序
- 字典序
- 字典序
- 字典序
- 字典序
- NEUOJ 719 (字典树 字典序)
- 字典序生成组合
- 字典序问题
- 再论字典序
- 字典序全排列
- 深搜 字典序
- 字典序集合
- 字典序法
- 字典序全排列
- 字典序问题
- 201409-2 画图 ccf
- 二叉树的镜像
- 浅析指针数组、数组指针、函数指针、指针函数、函数指针数组的指针
- 这几天编的随机数生成小程序,给学校利用的,请大家参考并指出问题!
- 龟头子能泡酒吗|龟头子泡酒怎么泡
- 字典序
- 计算机网络(二):物理层和数据链路层
- python中的format函数
- Shiro(四) 自定义Realm
- Java Socket数据转发和http代理(使用公网ip服务器转发数据)
- 表单按回车自动提交
- 【图解】PCB快速制板,热转印机+腐蚀槽
- 枚举:熄灯问题
- Spring MVC json报406错误的解决办法 Failed to load resource: the server responded with a status of 406