标签:
var a:array[0..208,0..208] of int64; mo:int64; i,j,n,temp:longint; function guess:int64; var i,j,k,t:longint; ans:int64; begin ans:=1; for i:=1 to n do begin for j:=i+1 to n do begin while a[j,i]<>0 do begin t:=a[i,i] div a[j,i]; for k:=i to n do begin a[i,k]:=a[i,k]-t*a[j,k]; a[i,k]:=a[i,k] mod mo; end; for k:=1 to n do begin temp:=a[i,k]; a[i,k]:=a[j,k]; a[j,k]:=temp; end; ans:=-ans; end; end; if a[i,i]=0 then exit(0); ans:=ans*a[i,i] mod mo; end; if ans<0 then ans:=ans+mo; exit(ans); end; begin readln(n,mo); for i:=1 to n do for j:=1 to n do read(a[i,j]); writeln(guess); end.
标签:
原文地址:http://www.cnblogs.com/rpSebastian/p/4306720.html