F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Evaluation of Determinant

Time 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
2 1009 1 2 3 4
 

Sample Output
1007
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 10:09:44, Gzip enabled