-
算法实现题2
算法实现题2-9 排列的字典序问题
« 问题描述:
n个元素{1,2, , n }有n!个不同的排列。将这n!个排列按字典序排列,并编号为0,1,…,
n!-1。每个排列的编号为其字典序值。例如,当n=3时,6 个不同排列的字典序值如下:
字典序值 0 1 2 3 4 5
排列 123 132 213 231 312 321
« 编程任务:
给定n 以及n 个元素{1,2, , n }的一个排列,计算出这个排列的字典序值,以及按字
典序排列的下一个排列。
« 数据输入:
由文件input.txt提供输入数据。文件的第1 行是元素个数n。接下来的1 行是n个元素
{1,2, , n }的一个排列。
« 结果输出:
程序运行结束时,将计算出的排列的字典序值和按字典序排列的下一个排列输出到文件
output.txt中。文件的第一行是字典序值,第2行是按字典序排列的下一个排列。
输入文件示例 输出文件示例
input.txt output.txt
8
2 6 4 5 8 1 7 3
8227
2 6 4 5 8 3 1 7
- 2022-02-12 05:10:54下载
- 积分:1
-
好好的用摄像头抓图的工具哦
好好的用摄像头抓图的工具哦-camera with a good screen in the tool Oh!
- 2022-07-19 23:38:47下载
- 积分:1
-
资料比较好
有程序,容易学习
容易看的懂
资料比较好
有程序,容易学习
容易看的懂-Better information on procedures, easier to learn to read easy to understand
- 2022-03-15 01:09:03下载
- 积分:1
-
文件内容比较,支持文件夹,先比较时间后比较内容.
文件内容比较,支持文件夹,先比较时间后比较内容.-Compare the contents of the documents in support folder.
- 2022-03-23 01:51:44下载
- 积分:1
-
佳能OCX源码,炮cdsdk 7.3,佳能相机的开发工具包。没有…
佳能OCX源代码,Cannon CDSDK 7.3,Cannon 相机开发包. 尚未经过经过测试。-Canon OCX source code, Cannon CDSDK 7.3, Cannon Camera Development Kit. Has not been tested.
- 2023-01-20 11:55:04下载
- 积分:1
-
Memory operations, wanted to get into deeper learning the computer, then the mem...
内存操作,想进入计算机更深一步的学习的话,内存操作很重要-Memory operations, wanted to get into deeper learning the computer, then the memory operation is very important ... ...
- 2023-09-03 17:50:03下载
- 积分:1
-
Drawing any plant function curve using ATL ActiveX
用 ATL ActiveX 绘制任意平面函数的曲线 -Drawing any plant function curve using ATL ActiveX
- 2022-10-27 05:10:03下载
- 积分:1
-
List of useful functions to treat SQL values
List of useful functions to treat SQL values
- 2023-08-29 07:15:03下载
- 积分:1
-
比较完善的图书馆管理系统,如有不明白之处请email本人。
比较完善的图书馆管理系统,如有不明白之处请email本人。-A fairly complete library management system, if not understand, please email me.
- 2022-07-23 00:13:07下载
- 积分:1
-
C语言工具集合,集成了超多C语言的工具源代码,像一些库函数的实现...
C语言工具集合,集成了超多C语言的工具源代码,像一些库函数的实现-C language tools to gather more integrated C-language source code for a tool, as some of the library functions to achieve
- 2022-02-05 10:08:46下载
- 积分:1