[hdu6595]Everything Is Generated In Equal Probability

Posted pywbktda

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[hdu6595]Everything Is Generated In Equal Probability相关的知识,希望对你有一定的参考价值。

计算一对逆序对的贡献,即在n个数期望要删多少步才能删掉其中的两个数,设f(n)表示此时的期望,则有方程$f[n]=3/4+(\sum_i=2^nf[i]\cdot c(n-2,i-2))/2^n$,手算(打表)得到f[i]=4/3(代入成立),因此$ans=\sum_i=1^n(i-1)i/3=1/3(n(n+1)(2n+1)/6-n(n+1)/2)=(n-1)(n+1)/9$

技术图片
1 #include<bits/stdc++.h>
2 using namespace std;
3 int n;
4 int main()
5     while (scanf("%d",&n)!=EOF)printf("%d\n",443664157LL*(n-1)*(n+1)%998244353);
6 
View Code

 

以上是关于[hdu6595]Everything Is Generated In Equal Probability的主要内容,如果未能解决你的问题,请参考以下文章

why "Everything" is so fast?

LA2995 Image is everything

Image Is Everything LA2995

everything is a object

一切系统都是分布式的:Everything is distributed

[数学递推]Everything Is Generated In Equal Probability