How to count the number of permutations?

Revision en1, by codemode, 2019-06-20 16:30:05

We are given a sequence : [1,2,...N]. Lets consider all the permutations of the above sequence. Now, a good permutation is defined as the one in which there is atleast one pair of numbers such that a[i]+1=a[i+1]. How to count the number of good permutations ? This problem is from some old contest.

#### History

Revisions

Rev. Lang. By When Δ Comment
en1 codemode 2019-06-20 16:30:05 343 Initial revision (published)