文章

68

粉丝

691

获赞

26

访问

578.3k

头像
矩阵快速幂
P1486
发布于2020年5月26日 18:31
阅读数 6.9k

https://blog.csdn.net/csyifanZhang/article/details/104594647?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522159048905419195265959311%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=159048905419195265959311&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_v2~rank_v25-1-104594647.nonecase&utm_term=%E5%BF%AB%E9%80%9F%E5%B9%82

 

#define ll int
#define vec vector<ll>
#define inf 0x3f3f3f3f
#define MAX 200005
#define P pair<ll,ll>
#define MOD 100000

struct mat {
	long long arr[25][25], col, row;
	mat(int m = 0, int n = 0, int k = 0) {
		for (int i = 0; i < m; i++)
			for (int j = 0; j < n; j++)
				arr[i][j] = 0;
		row = m, col = n;
		if (k == 1)
			for (int i = 0; i < m; i++)arr[i][i] = 1;
	}

	mat operator*(mat m) {
		int r = row, l = m.col, t = col;
		mat res(r, l);
		for (int i = 0; i < r; i++)
			for (int j = 0; j < col; j++)
		...
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发