问题2442--Determinant

2442: Determinant

时间限制: 90 Sec  内存限制: 128 MB
提交: 10  解决: 1
[提交] [状态] [讨论版] [命题人:]

题目描述

Bobo learned the definition of determinant det(A) of matrix A in ICPCCamp. He also knew determinant
can be computed in O(n3) using Gaussian Elimination.
Bobo has an n×n matrix B he would like to find det(Bi,j) modulo (109 +7) for all i, j ∈ {1, 2, . . . , n} where
Bi is the matrix after removing the i-th row and j-th column from B.
It is guaranteed that the each column sum of B is a multiple of (109 + 7).

输入

The input contains zero or more test cases and is terminated by end-of-file. For each test case:
The first line contains an integer n. The i-th of following n lines contains n integers Bi,1,Bi,2, . . . ,Bi,n.
• 2 n 500
• 0 Bi,j < 109 + 7
• The sum of n does not exceed 5000.

输出

For each case, output n rows where the i-th row contains n integers det(Bi,1), det(Bi,2), . . . , det(Bi,n) modulo
(109 + 7).

样例输入

2
0 1
0 1000000006

样例输出

1000000006 0
1 0

来源/分类


[提交] [状态]