题号:NC234893
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld
题目描述
给定一个数组

以及一个整数

。并通过它运行下面的代码:
long long ans = 0; // create a 64-bit signed variable which is initially equal to 0
for(int i = 1; i <= k; i++)
{
int idx = rnd.next(0, n - 1); // generate a random integer between 0 and n - 1, both inclusive
// each integer from 0 to n - 1 has the same probability of being chosen
ans += a[idx];
a[idx] -= (a[idx] % i);
}
你的任务是运行结束后计算变量

的值。
注意输入是由特殊规则生成的(见输入格式描述)。
输入描述:
第一行包含六个整数
)
。
数组

通过以下方式生成:

在输入中给出
输出描述:
假设最后
的期望值是
,可以证明
是一个整数,输出这个整数对
取模的结果。
示例1
说明
数组是
。
示例2
输入
复制
2 15363 270880 34698 17 2357023
说明
数组是
。