ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Арифметика > задача:


50384 - Permutations revisited

Гость
• Вопросы к жюри (1)

Задачи раздела

• 50305 - John's Tasks
• 50649 - Puzzle
• 50321 - Missing Number
• 50308 - IT Knowledge Seminars
• 50310 - Kinetic Energy
• 50314 - Falling Distance
• 50316 - Population Bar Chart
• 50530 - Sum of Ratios
• 50384 - Permutations revisited
• 50368 - Right-most non zero digit in N!
• 50293 - Sum of odd numbers from ...
• 50365 - Sum of the numbers from a...
• 50388 - Number of Armstrong Num...
• 50363 - Class GPA Average
• 50390 - Total Salary Paid
• 50392 - How much space
• 50394 - Water Bills

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Ibrahim Mesecan.

Permutations revisited

 

In previous contest you were asked to find the k-th permutation of a series in lexicographical order, for a given k. Now, we are asking for the inverse: you are given a permuted series, and you need to output its order. The inputs admit that k can have at most 15 digits.

 

Sample Input 1                                  Sample Output 1

4                                                          8

2 1 4 3

 

Sample Input 2                                  Sample Output 2

5                                                          110

5 3 1 4 2

 

Explanation for sample output 1:

1 2 3 4  // First permutation

1 2 4 3

1 3 2 4

1 3 4 2

1 4 2 3

1 4 3 2

2 1 3 4

2 1 4 3   // 8th permutation

 

Для отправки решений необходимо выполнить вход.

www.contester.ru