标签:bsp names include ret int 邻接 review using ssi
#include<bits/stdc++.h> using namespace std; const int N = 505; const long long mod = 1e4+7; long long det(long long A[N][N],int n)// 0 ~ n-1 求行列式的值 { for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { A[i][j] = (A[i][j] % mod + mod) % mod; } } long long tmp = 1; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { while (A[j][i]) { long long t = A[i][i] / A[j][i]; for (int k = i; k < n; ++k) { A[i][k] = (A[i][k] - t * A[j][k]) % mod; } swap(A[i], A[j]); tmp *= -1; } } if (!A[i][i]) return 0; tmp = A[i][i] * tmp % mod; } return (tmp + mod) % mod; } /* 入度矩阵对应的外向树,出度矩阵对应着内向树(都是指向父亲的边的事是出度或者入度)无根树就是两条有向边都加上 有向树必须删掉根所在的那一行和一列,无根树可以任意 然后对于这n−1阶的矩阵求一个行列式就是最小生成树的个数 */ int main() { }
标签:bsp names include ret int 邻接 review using ssi
原文地址:https://www.cnblogs.com/tian-luo/p/11414265.html