1192 : Big Matrix
时间限制Time Limit
1
秒Sec
内存限制Memory Limit
128
兆MB
提交次数Submitted
1279
次Times
通过次数Solved
443
次Times
标准评测Standard Judge
题目描述Description
Given two matrices A and B with the same
size n \times n, and parameters a_{1},a_{2},b_{1},b_{2}, the two matrices are
defined as:
- A(i, j)=i\times a_{1} + j\times a_{2}
- B(i, j)=i\times b_{1} + j\times b_{2}
where i, j are 0, 1, 2, \cdots, n - 1.
Calculate the sum of all elements of C = AB.
输入格式Input
No more than 10 test cases. For each case, n a_{1}
a_{2} b_{1} b_{2}
are given.
- 1 \leq n \leq 1000
- 1 \leq a_{1}, a_{2}, b_{1}, b_{2} \leq 10^5
输出格式Output
The sum mod by 10^{9}+7.
样例Sample
出题Author
CSGrandeur
来源Source
湖南省第十八届大学生计算机程序设计竞赛(HNCPC2022)