SP1029 MATSUM - Matrix Summation
Description
A N × N matrix is filled with numbers. BuggyD is analyzing the matrix, and he wants the sum of certain submatrices every now and then, so he wants a system where he can get his results from a query. Also, the matrix is dynamic, and the value of any cell can be changed with a command in such a system.
Assume that initially, all the cells of the matrix are filled with 0. Design such a system for BuggyD. Read the input format for further details.
Input Format
The first line of the input contains an integer **t**, the number of test cases. **t** test cases follow.
The first line of each test case contains a single integer **N** (1
Output Format
For each test case, output one line for the answer to each "SUM" command. Print a blank line after each test case.
Explanation/Hint
$1\le N \le 1024$
$x_1\le x_2 \lt N\ ,\ y_1\le y_2\lt N$
保证答案是一个32位有符号整数。