Codeforces combinatorics problem (short statement) rated 1700 HELP

Revision en3, by btme, 2020-12-04 12:13:13

Let n be an integer. Consider all permutations on integers 1 to n in lexicographic order, and concatenate them into one big sequence p. For example, if n=3, then p=[1,2,3,1,3,2,2,1,3,2,3,1,3,1,2,3,2,1] . You are given n. Find the number of subarrays of p of length n having sum n(n+1)2. Since this number may be large, output it modulo 998244353 problem link

I AM NOT ABLE TO GET THE PART WHICH I HAVE MARKED WITH RECTANGLE. HOW THE FORMULA N!/K! CAME????????????

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English btme 2020-12-04 12:13:13 102
en2 English btme 2020-12-04 12:12:28 39
en1 English btme 2020-12-04 12:11:04 617 Initial revision (published)