当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5225:Tom and permutation

题目描述
Tom has learned how to calculate the number of inversions in a permutation of n distinct objects by coding, his teacher gives him a problem:
Give you a permutation of n distinct integer from 1 to n, there are many permutations of 1-n is smaller than the given permutation on dictionary order, and for each of them, you can calculate the number of inversions by coding. You need to find out sum total of them.
Tom doesn't know how to do, he wants you to help him.
Because the number may be very large, output the answer to the problem modulo ${10}^{9}+7$.
输入解释
Multi test cases(about 20). For each case, the first line contains a positive integer n, the second line contains n integers, it's a permutation of 1-n.
$n\leq 100$
输出解释
For each case, print one line, the answer to the problem modulo ${10}^{9}+7$.
输入样例
3
2 1 3
5
2 1 4 3 5
输出样例
1
75

提示
The input may be very big, we might as well optimize input.
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #40

源链接: HDU-5225

最后修改于 2020-10-25T23:20:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)