CDN加速镜像 | 设为首页 | 加入收藏夹
当前位置: 首页 资源下载 源码下载 Windows编程 .net编程

文件名称:zidianxu

  • 所属分类:
  • 标签属性:
  • 上传时间:
    2012-11-16
  • 文件大小:
    1.13kb
  • 已下载:
    0次
  • 提 供 者:
  • 相关连接:
  • 下载说明:
    别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容来自于网络,使用问题请自行百度

Descr iption



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

-Descr iption 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 lexicographic value, line 2 is arranged according to lexicographic order of the next. Sample Input 82 6 4 5 8 1 7 3Sample Output 82272 6 4 5 8 3 1 7
(系统自动生成,下载前可以参看下载内容)

下载文件列表

zidianxu.cpp

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 搜珍网是交换下载平台,只提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。更多...
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或换浏览器;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*快速评论: 推荐 一般 有密码 和说明不符 不是源码或资料 文件不全 不能解压 纯粹是垃圾
*内  容:
*验 证 码:
搜珍网 www.dssz.com