ICPC·2020·小米网络赛二

G Shift and Reverse

Topic

Bobo has a sequence $a_1,a_2,\dots,a_n$. He can rearrange the sequence using the following operation any number of times:

+ Select an integer i ($1 \le i \le n$) and change the sequence to $a_i, a_{i-1}, \dots, a_1, a_n, a_{n-1}, \dots, a_{i+1}$.

Bobo would like to know the number of different sequences can be obtained modulo $(10^9+7)$.

波波有一个序列$a_1,a_2,\dots,a_n$。他可以使用以下操作任意次数重新排列序列:

选择整数i($1 \le i \le n$)并将序列更改为$a_i, a_{i-1}, \dots, a_1, a_n, a_{n-1}, \dots, a_{i+1}$。

Bobo想知道有多少个不同的序列对$(10^9+7)$取模。

Analyse

遇到题目没思路就先模拟一下

一个新的数组a,标号从a1-an,假定选择k进行反转操作,执行操作后的序列为$a_{k},a_{k-1}…a_{k+2},a_{k+1},$

Welcome to my other publishing channels