Description: acm algorithm design: the problem with the dictionary sequence
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 number of each sequence value for the dictionary. For example, when n = 3, the six different sequence with the value of the dictionary is as follows:
Lexicographic values: 0 1 2 3 4 5
Order: 123 132 213 231 312 321
Tasks: to set n and n elements (1,2 ,..., n) an arranged order to calculate the value of the dictionary sequence and arranged according to lexicographic order of the next.
Input:
Line 1 is the number of elements n (n <15). Line 1 is the next n elements (1,2 ,..., n) an order.
Output:
The first line is the value of the dictionary sequence, line 2 is arranged according to lexicographic order of the next.
Cases of type:
8
2 6 4 5 8 1 7 3
Cases the output:
8227
2 6 4 5 8 3 1 7
- [allwithaclassicalalgorithm.Rar] - the procedure is in accordance with the
- [GA488] - GA procedures, using MATLAB prepared, ve
- [permrank] - The algorithm realizes the dictionary or
- [zidianxu] - Description n elements (1,2 ,..., n) the
- [matlab2] - Hungary algorithm matlab procedures, wri
- [ACM] - acm is a ativity for university students
- [code] - Algorithm acm C++
- [WorkAssignment] - acm algorithm design with n pieces of wo
- [acm] - ACM algorithm template that contains the
File list (Check if you may need any files):
排列的字典序问题
................\Debug
................\.....\StdAfx.obj
................\.....\vc60.idb
................\.....\vc60.pdb
................\.....\排列的字典序问题.exe
................\.....\排列的字典序问题.ilk
................\.....\排列的字典序问题.obj
................\.....\排列的字典序问题.pch
................\.....\排列的字典序问题.pdb
................\ReadMe.txt
................\StdAfx.cpp
................\StdAfx.h
................\排列的字典序问题.cpp
................\排列的字典序问题.dsp
................\排列的字典序问题.dsw
................\排列的字典序问题.ncb
................\排列的字典序问题.opt
................\排列的字典序问题.plg