1599. Partial differential equations

单点时限: 2.0 sec

内存限制: 256 MB

输入格式

The input file consists of m tests. The number m is given in the first line of the file. The first line of each test contains the number n which gives the number of discretizations intervals as defined above. You may assume that 2<=n<=30 . Then the 3*3 matrices v and g follow. The following four lines contain the functions b1,b2,b3 and b4 , each given as a vector of order n+1, containing the values for 0, h, 2h, …, 1. Finally, the function f is given as a n+1 by n+1 matrix. Like the vectors before, it contains the values for x,y=0,h,2h,…1. Each row contains from left to right the function values for increasing x values while each column contains from top to bottom the function values for decreasing y values.

A vector occupies one line. Its values are given in ascending order, separated by a space. A n by n matrix occupies n lines. Its rows are given in ascending order as vectors, which occupy one line each. All values found in the input file are integer values.

输出格式

For each test found in the input file, your program should output the matrices a and b. Matrix a is a (n-1)^2*(n-1)^2 matrix (the discretization area (cf. figure 2) contains (n-1)^2 inner points, which are unknown). The vector b is of order (n-1)^2. They should be output in the same format as the vectors and matrices in the input file. Your output should only contain integer values. Note that the expression 1/(k^2) yields an integer number and that all other calculations can also be done using integer numbers.

样例

Input
1
3
1 0 2
0 -4 0
3 0 4
0 5 0
6 0 7
0 8 0
3 4 5 6
0 1 2 3
3 2 1 0
6 5 4 3
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
Output
-36 0 0 36
0 -36 27 0
0 18 -36 0
9 0 0 -36
-35 -188 -189 -315

0 人解决,2 人已尝试。

0 份提交通过,共有 3 份提交。

9.9 EMB 奖励。

创建: 17 年,3 月前.

修改: 7 年,2 月前.

最后提交: 14 年,2 月前.

来源: UVa

题目标签