-
算法实现题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
-
一个介绍圆角矩形的异形窗口程序
一个介绍圆角矩形的异形窗口程序-a rectangular fillet on a square window procedure
- 2023-06-07 16:30:03下载
- 积分:1
-
欧洲密克罗尼西亚推荐算法。分组长度128bit加密…
欧密会推荐算法Camellia。加密分组长度128bits,密码长度128bits-European Micronesia recommend algorithm Camellia. Encrypted packet length 128bits, password length 128bits
- 2022-05-05 20:34:44下载
- 积分:1
-
火星星历29 kb。
Mars ephemeris size 29 KB.
Trigonometric expansion for the ephemeris of Mars (Bretagnon). Medium accuracy (4" longitude), tested against DE200.
火星星历计算程序。-Mars ephemeris size 29 KB. Trigonometric expansion for the ephemeris of Mars (Bretagnon). Medium accuracy (4
- 2022-03-21 11:08:24下载
- 积分:1
-
documents linked to a certain type of application, the production of such docume...
文件类型关联到某个应用程序中,这样生成的文件就可以默认用你的程序打开了-documents linked to a certain type of application, the production of such documents can use the default procedure opened the
- 2023-08-10 14:00:03下载
- 积分:1
-
INA128/INA129DATASHEET
INA128和INA129是低功耗高精度的通用仪表放大器-INA128/INA129DATASHEET
- 2022-02-05 04:20:01下载
- 积分:1
-
空间后方交会和前方交会是摄影测量数据处理的基础,给出的算法和源代码供参考...
空间后方交会和前方交会是摄影测量数据处理的基础,给出的算法和源代码供参考-Space resection and intersection in front of photogrammetric data processing is the basis for the algorithm and source code are given for reference
- 2022-03-11 17:37:26下载
- 积分:1
-
WPF 自定义屏幕
• 检查各种 "风味" 的 WPF 应用程序
• 概述 WPF 提供的服务
• 审查的核心 WPF 程序集和命名空间
• 与窗口和应用程序的类类型
• 了解 XAML 的语法
• 了解 XAML/代码的关系
• 调查核心 WPF 控件类型
• 审查的 WPF 控件的编程模型
• 学会定位控件使用布局管理器
• 了解 WPF 控制命令的作用
• 了解 WPF 文档的 API 的范围
• 区分固定的文档和流文档
• 用填充文档中线和块元素
• 工作与 WPF 文档的 Api
- 2022-01-27 19:28:56下载
- 积分:1
-
良好功能界面,实现学生信息管理,
CHLOR.H头文件主要是考虑以后给程序加快捷键等,方便程序的功能扩展
BAT是测试数据文件...
良好功能界面,实现学生信息管理,
CHLOR.H头文件主要是考虑以后给程序加快捷键等,方便程序的功能扩展
BAT是测试数据文件-Good functional interface, the achievement of students in information management, CHLOR.H header file after the main consideration to the processes, such as shortcut keys to facilitate the procedures for the function of the expansion of BAT is a test data file
- 2022-03-16 07:12:26下载
- 积分:1
-
MDI的动态链接库
MDI动态连接库-MDI Dynamic Link Library
- 2022-10-11 17:30:03下载
- 积分:1