5610 CF891E Lust
时间限制:2000毫秒
内存限制:64MB
题目描述 De**ion
A false witness that speaketh lies!
You are given a sequence containing nn integers. There is a variable resres that is equal to 00 initially. The following process repeats kk times.
Choose an index from 11 to nn uniformly at random. Name it xx . Add to resres the multiply of all aiai 's such that 1<=i<=n1<=i<=n , but ii≠xx . Then, subtract axax by 11 .
You have to find expected value of resres at the end of the process. It can be proved that the expected value of resres can be represented as an irreducible fraction
. You have to find
.
输入描述 Input De**ion
The first line contains two integers nn and kk ( 1<=n<=50001<=n<=5000 , 1<=k<=1091<=k<=109 ) — the number of elements and parameter kk that is specified in the statement.
The second line contains nn space separated integers a1,a2,...,ana1,a2,...,an ( 0<=ai<=1090<=ai<=109 ).
输出描述 Output De**ion
Output a single integer — the value
.
输入输出样例
输入 #1
输入 #1 2 1 5 5 ########### 输入 #2 1 10 80 ########### 输入 #3 2 2 0 0 ########### 输入 #4 9 4 0 11 12 9 20 7 8 18 2
输出 #1
输出 #1 5 ########### 输出 #2 10 ########### 输出 #3 500000003 ########### 输出 #4 169316356
RemoteJudge
您提交的代码将被发送回原 OJ 进行测评,并由酷丁编程抓取其测评结果。
将使用公用账户进行测评,建议您 绑定个人账户,使用自己在原 OJ 的账户提交测评。
题目描述
你有 nn 个数 a1,a2,⋯ ,ana1,a2,⋯,an 要进行 kk 次操作,每次随机选择一个数 x∈[1,n]x∈[1,n],把 axax 减一,并将答案增加除 axax 外所有数的乘积。
求最终答案的期望,答案对 109+7109+7 取模。
说明/提示
CodeForces 题目提交时的注意事项:
CodeForces 不允许多次提交同样的代码。如果您如此提交将会产生提交失败错误。如您确实需要这么做,请自行添加一些注释。
编程语言:
