|
||||||||||
The Evaluation of DeterminantTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1419 Accepted Submission(s): 440 Problem Description The determinant is quite important in Linear Algebras, but I think that almost everyone who has ever learnt Linear Algebras is tired of the complicated and tedious calculations of determinant. Actually, itĄ¯s not the job we should do, isnĄ¯t it? As an outstanding Geek, why donĄ¯t we just ask computers to do these? Give you a determinant D (itĄ¯s ensured that the result of it is an integer) and m, try to get the result of this determinant mod m, and m = p1 * p2 ĄĄ pn, all the pi are different. You can assume 1000 < pi < 10000, aij < 1000, and m can be fit in 32-bit signed integer. Input Input two integers n and m in the first line, n represents the scale of the determinant. (n <= 100) Then comes an n * n matrix, the determinantĄ¯s component aij means the one in row i and column j. Output Output the result of the determinant D mod m. Sample Input
Sample Output
Source | ||||||||||
|