Given a permutation PPP of {1,2,,n}{1,2,cdots, n}{1,2,,n}, determine the number of {1,2,,n}{1,2,cdots, n}{1,2,,n} permutations QQQ satisfying that i∈{1,2,,n1},Qi+1≠PQifora
Given a permutation PPP of {1,2,⋯ ,n}{1,2,cdots, n}{1,2,⋯,n}, determine the number of {1,2,⋯ ,n}{1,2,cdots, n}{1,2,⋯,n} permutations QQQ satisfying that ∀i∈{1,2,⋯ ,n−1},Qi+1≠PQiforall i in {1, 2, cdots, n - 1}, Q_{i+1} neq P_{Q_i}∀i∈{1,2,⋯,n−1},Qi+1=PQi. Output the number modulo 998244353998244353998244353.
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。