4 solutions

  • -2
    @ 2024-4-26 19:38:31
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1010;
    int a[N][N],b[N][N],c[N][N];
    int main()
    {
    	int n,m,k;
    	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 t=1;t<=m;t++)
    			{
    				c[i][j]+=a[i][t]*b[t][j];
    			}
    		}
    	}
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=k;j++)
    		{
    			cout<<c[i][j]<<" ";
    		}
    		cout<<endl;
    	}
    	return 0;
    }
    
    • -5
      @ 2024-5-19 11:15:24

      #include<bits/stdc++.h> using namespace std; const int N=1010; int a[N][N],b[N][N],c[N][N]; int main() { int n,m,k; 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 t=1;t<=m;t++) { c[i][j]+=a[i][t]*b[t][j]; } } } for(int i=1;i<=n;i++) { for(int j=1;j<=k;j++) { cout<<c[i][j]<<" "; } cout<<endl; } return 0; }

      • -6
        @ 2024-10-4 9:23:11

        wcwcwcwcwcwcwcwcwcwcwcwcwcwcwcwcw

        • -6
          @ 2024-9-28 11:49:48

          mnm

          • 1

          Information

          ID
          907
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          3
          Tags
          (None)
          # Submissions
          73
          Accepted
          36
          Uploaded By