首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > Description n elements (1,2 ,..., n) there are n! Different order. This n! Were...

Description n elements (1,2 ,..., n) there are n! Different order. This n! Were...

  • 资源大小:1.13 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: .net

资 源 简 介

Description n个元素{1,2,..., n }有n!个不同的排列。将这n!个排列按字典序排列,并编号为0,1,…,n!-1。每个排列的编号为其字典序值。例如,当n=3时,6 个不同排列的字典序值如下: 任务:给定n 以及n 个元素{1,2,..., n }的一个排列,计算出这个排列的字典序值,以及按字典序排列的下一个排列。 Input 第1 行是元素个数n(n < 15)。接下来的1 行是n个元素{1,2,..., n }的一个排列。 Output 第一行是字典序值,第2行是按字典序排列的下一个排列。 Sample Input 8 2 6 4 5 8 1 7 3 Sample Output 8227 2 6 4 5 8 3 1 7 -Description n elements (1,2 ,..., n) there are n! Different order. This n! Were arranged according to lexicographic order, and numbered 0,1, ..., n!-1. With the numbering of each sequence value for the dictionary. For example, when n = 3 when six different lexicographic order of value are as follows: Missions: given n and n elements (1,2 ,..., n) an array to calculate the lexicographic order of value , as well as lexicographic order with the next. Input Line 1 is the number of elements n (n <15). The next one line is n elements (1,2 ,..., n) of an array. Output the first line is the l

文 件 列 表

zidianxu.cpp
VIP VIP
0.189887s