1 solutions
-
0
#include <stdio.h> int main() { int n,m,k,t,i,j,x,y; scanf("%d %d %d",&n,&m,&k); int a[n][m]; int b[m][k]; int sum=0; for( i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&a[i][j]); } } for(i=0;i<m;i++){ for(j=0;j<k;j++){ scanf("%d",&b[i][j]); } } int c[n][k]; j=0; i=0; while(i!=n&&j!=k){ x=i; y=j; sum=0; for(t=0;t<m;t++){ sum=sum+a[x][t]*b[t][y]; } c[i][j]=sum; j++; if(j==k){ j=0; i++; } } for(i=0;i<n;i++){ for(j=0;j<k;j++){ printf("%d ",c[i][j]); } printf("\n"); } return 0; }
- 1
Information
- ID
- 6783
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 7
- Tags
- (None)
- # Submissions
- 155
- Accepted
- 30
- Uploaded By