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

建议使用的浏览器:

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

6336:Problem E. Matrix from Arrays

题目描述
Kazari has an array $A$ length of $L$, she plans to generate an infinite matrix $M$ using $A$.
The procedure is given below in C/C++:

int cursor = 0;
for (int i = 0; ; ++i) {
for (int j = 0; j <= i; ++j) {
M[j][i - j] = A[cursor];
cursor = (cursor + 1) % L;
}
}


Her friends don't believe that she has the ability to generate such a huge matrix, so they come up with a lot of queries about $M$, each of which focus the sum over some sub matrix. Kazari hates to spend time on these boring queries. She asks you, an excellent coder, to help her solve these queries.
输入解释
The first line of the input contains an integer $T$ $(1 \le T \le 100)$ denoting the number of test cases.
Each test case starts with an integer $L$ $(1 \le L \le 10)$ denoting the length of $A$.
The second line contains $L$ integers $A_0, A_1, ..., A_{L - 1}$ $(1 \le A_i \le 100)$.
The third line contains an integer $Q$ $(1 \le Q \le 100)$ denoting the number of queries.
Each of next $Q$ lines consists of four integers $x_0, y_0, x_1, y_1$ $(0 \le x_0 \le x_1 \le 10 ^ 8, 0 \le y_0 \le y_1 \le 10 ^ 8)$ querying the sum over the sub matrix whose upper-leftmost cell is $(x_0, y_0)$ and lower-rightest cell is $(x_1, y_1)$.
输出解释
For each test case, print an integer representing the sum over the specific sub matrix for each query.
输入样例
1		
3		
1 10 100
5		
3 3 3 3
2 3 3 3
2 3 5 8
5 1 10 10
9 99 999 1000
输出样例
1
101
1068
2238
33076541
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6336

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

共提交 0

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