1 条题解

  • 0
    @ 2025-10-18 14:44:22
    #include<bits/stdc++.h>
    #define ll unsigned long long
    #define sg string
    #define double db
    #define Up(i,first,last) for(int i=first;i<=last;i++)
    #define Down(i,first,last) for(int i=first;i>=last;i--)
    using namespace std;
    ll n,m,k,a[1005][1005],b[1005][1005],c[1005][1005];
    int main()
    {
    	ios::sync_with_stdio(false);
    	cin.tie(0),cout.tie(0);
    	cin>>n>>m>>k;
    	for(int i=1;i<=n;i++)
    		for(int j=1;j<=m;j++) cin>>a[i][j];
    	for(int i=1;i<=m;i++)
    		for(int j=1;j<=k;j++) cin>>b[i][j];
    	for(int i=1;i<=n;i++)
    		for(int j=1;j<=k;j++)
    			for(int l=1;l<=m;l++)
    				c[i][j]+=a[i][l]*b[l][j];
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=k;j++) cout<<c[i][j]<<' ';
    		cout<<'\n';
    	}
    }
    
    • 1

    信息

    ID
    458
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    8
    已通过
    4
    上传者