标签:sync sign mes submit name efi syn const footer
2019
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; const int maxn = 126; int n, m; int a[maxn][maxn], b[maxn][maxn]; int c[maxn][maxn]; int i, j, k; void mul(int x[maxn][maxn], int y[maxn][maxn]) { for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { c[i][j] = 0; for (k = 1; k <= n; k++) c[i][j] = (c[i][j] + x[i][k] * y[k][j]) % mod; } } for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { x[i][j] = c[i][j]; } } } void ksm() { m++; while (m) { if (m & 1) mul(b, a); m >>= 1; mul(a, a); } } signed main() { //freopen("in","r",stdin); ios::sync_with_stdio(0); cin >> n >> m; for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { cin >> a[i][j]; } a[i][i + n] = a[i + n][i + n] = b[i][i] = b[i + n][i + n] = 1; } n *= 2; // for (i = 1; i <= n; i++) { // for (j = 1; j <= n; j++) { // cout << " " << a[i][j]; // } // cout << endl; // } ksm(); n /= 2; for (i = 1; i <= n; i++) b[i][i + n]--; for (i = 1; i <= n; i++) { for (j = 1; j <= n; j++) { if (j != n) cout << b[i][j + n] << " "; else cout << b[i][j + n] << endl; } } return 0; }
标签:sync sign mes submit name efi syn const footer
原文地址:https://www.cnblogs.com/xcfxcf/p/12457714.html