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

建议使用的浏览器:

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

5226:Tom and matrix

题目描述
Tom was on the way home from school. He saw a matrix in the sky. He found that if we numbered rows and columns of the matrix from 0, then,
${a}_{i,j}=C_{i}^{j}$

if i < j, ${a}_{i,j}=0$

Tom suddenly had an idea. He wanted to know the sum of the numbers in some rectangles. Tom needed to go home quickly, so he wouldn't solve this problem by himself. Now he wants you to help him.
Because the number may be very large, output the answer to the problem modulo a prime p.
输入解释
Multi test cases(about 8). Each case occupies only one line, contains five integers, ${x}_{1}、{y}_{1}、{x}_{2}、{y}_{2}、p.
{x}_{1}\leq {x}_{2}\leq {10}^{5},{y}_{1}\leq {y}_{2}\leq {10}^{5},2\leq p\leq {10}^{9}$.

You should calculate $\sum_{i={x}_{1}}^{{x}_{2}}\sum_{j={y}_{1}}^{{y}_{2}}{a}_{i,j}$ mod p
输出解释
For each case, print one line, the answer to the problem modulo p.
输入样例
0 0 1 1 7
1 1 2 2 13
1 0 2 1 2
输出样例
3
4
1
来自杭电HDUOJ的附加信息
Recommend hujie

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

题目来源 BestCoder Round #40

源链接: HDU-5226

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

共提交 0

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