大佬求助,为什么这个爆零了
查看原帖
大佬求助,为什么这个爆零了
1400506
Eric_gooooood楼主2024/7/29 14:03
#include <iostream>
 using namespace std;
 int main(){
	int n,m,k;
	cin>>n>>m>>k;//确定nmk 
	long A[n][m],B[m][k];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		cin>>A[i][j];
	}//输入矩阵A 
	for(int a=0;a<m;a++)
	{
		for(int b=0;b<k;b++)
		cin>>B[a][b];
	}//输入矩阵B 
 	long C[n][k];
	for(int x=0;x<n;x++)
	{	
		for(int y=0;y<k;y++)
			for(int t=0;t<m;t++)
			C[x][y]=C[x][y]+A[x][t]*B[t][y];
	}//计算矩阵C 
	for(int w=0;w<n;w++)
	{
		for(int e=0;e<k;e++)
		{
			cout<<C[w][e]<<' ';
		}
		cout<<endl;
	}//输出矩阵C 
	return 0;
}'''
2024/7/29 14:03
加载中...