矩阵在竞赛中的应用
矩陣乘法代碼:
struct matrix {int n, m;int a[100][100]; }; // A.m == B.n matrix matrix_mul(matrix A, matrix B) {matrix C;C.n = A.n;C.m = B.m;for (int i = 0; i < A.n; ++i) {for (int j = 0; j < B.m; ++j) {C.a[i][j] = 0;for (int k = 0; k < A.m; ++k) {C.a[i][j] += A.a[i][k] * B.a[k][j];}}}return C; }下一節:矩陣二分快速冪優化dp
轉載于:https://www.cnblogs.com/fisherss/p/10305698.html
總結
- 上一篇: Phaser3让超级玛丽实现轻跳、高跳及
- 下一篇: 二维数组(声明以及遍历)