Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #define fo(i,x,y) for (int i=x;i<=y;++i)
- int n,m,p,a[100][100],b[100][100];
- int main(){
- scanf("%d%d%d",&n,&m,&p); //matrix_a is n*m, matrix_b is m*p
- fo(i,1,n)
- fo(j,1,m) scanf("%d",&a[i][j]);
- fo(i,1,m)
- fo(j,1,p) scanf("%d",&b[i][j]);
- fo(i,1,n){
- fo(j,1,p){
- int t=0;
- fo(k,1,m)
- t+=a[i][k]*a[k][j];
- if (j>1) printf(" ");
- printf("%d",t);
- }
- printf("\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment