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

建议使用的浏览器:

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

6439:Congruence equation

题目描述
There is a sequence $A$ which contains $k$ integers.
Now we define $f\left(m\right)$ is the number of different sequence $C$ that satisfies for $i$ from $1$ to $k$:
1. If $A_{i} = -1$, $C_{i}$ can be any integer in the range of $[0, m)$.Otherwise $C_{i} = A_{i} \pmod m$
2. $\sum\limits_{i = 1} ^{k} C_{i}x_{i} \equiv 1 \pmod m$($x_{i}$ are variables) have a solution in the range of integer.

Calculate the answer of $\sum\limits_{m = 1} ^{n} f(m) \pmod{10^9+7}$.
输入解释
The first line contains only one integer $T ( T \leq 100)$, which indicates the number of test cases.
For each test case, the first line contains two integers $k$ and $n$.($1 \leq k \leq 50, 1 \leq n \leq 10^9$)
The second line contains $k$ integers: $A_{1}, A_{2} \dots A_{k}(-1 \leq A_{i} \leq 10^9)$
There are at most $10$ test cases which satisfies $n \geq 10^6$
输出解释
For each test case, output one line "Case #x: y", where x is the case number (starting from 1) and y is the answer after mod 1000000007 ($10^9+7$).
输入样例
2
5 10
-1 -1 8 -1 -1
3 20
-1 6 18
输出样例
Case #1: 24354
Case #2: 140
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6439

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

共提交 0

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