Amy asks Mr. B problem C. Please help Mr. B to solve the following problem. Given an array aiwith length n, and a base b. For each permutation {ri} of {ai}, we count the number of inversions as t. Please calculate ∑{ri}isapermutationof{ai}btsum_{{r_i} text{is a permutation of} {a_i}} b^{t}∑{ri}isapermutationof{ai}bt As the answer might be very large, please output it modulo 1000000007.
Amy asks Mr. B problem C. Please help Mr. B to solve the following problem. Given an array ai with length n, and a base b. For each permutation {ri} of {ai}, we count the number of inversions as t({ri}). Please calculate ∑{ri}is a permutation of{ai}bt({ri})sum_{{r_i} text{is a permutation of} {a_i}} b^{t({r_i})}∑{ri}is a permutation of{ai}bt({ri}) As the answer might be very large, please output it modulo 1000000007.
(图片来源网络,侵删)