Demo entry 6770754

py

   

Submitted by 反对法 on Nov 14, 2018 at 13:55
Language: C++. Code size: 379 Bytes.

#define LL long long 
const int Size = 110;
void mulit_rect(LL a[][Size],LLb[][Size],int n,int m,int K,LL P){
	LL c[Size][Size];

	// 矩阵乘法的核心
	memset(c,0,sizeof c);
	for(int i=0;i<n;++i)
		for(int j=0;j<K;++j)
			for(int k=0;k<m;++k)
				c[i][j]=(c[i][j]+a[i][k]*b[k][j]%P)%P;
	// 修改 矩阵A = A*B ,
	for(int i=0;i<n;++i)
		for(int j=0;j<K;++j)
			a[i][j]=c[i][j];

}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).