#include <stdio.h>
int ans[2][2];
void array_mul(int (*x)[2],int (*y)[2],int (*ans)[2]){
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
ans[i][j]=0;
for(int k=0;k<2;k++){
ans[i][j]=x[i][k]*y[k][j]+ans[i][j];
}
}
}
}
int main(){
int x[2][2]={{1,2},{3,4}};
int y[2][2]={{1,2},{3,4}};
array_mul(x,y,ans);
printf("行列xと行列yの内積\nans={%d,%d}\n ,{%d,%d}",ans
[0][0],ans
[0][1],ans
[1][0],ans
[1][1]); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgYW5zWzJdWzJdOwoKdm9pZCBhcnJheV9tdWwoaW50ICgqeClbMl0saW50ICgqeSlbMl0saW50ICgqYW5zKVsyXSl7Cglmb3IoaW50IGk9MDtpPDI7aSsrKXsKCQlmb3IoaW50IGo9MDtqPDI7aisrKXsKCQkJYW5zW2ldW2pdPTA7CgkJCWZvcihpbnQgaz0wO2s8MjtrKyspewoJCQkJYW5zW2ldW2pdPXhbaV1ba10qeVtrXVtqXSthbnNbaV1bal07CgkJCX0KCQl9Cgl9Cn0KCmludCBtYWluKCl7CglpbnQgeFsyXVsyXT17ezEsMn0sezMsNH19OwoJaW50IHlbMl1bMl09e3sxLDJ9LHszLDR9fTsKCWFycmF5X211bCh4LHksYW5zKTsKCXByaW50Zigi6KGM5YiXeOOBqOihjOWIl3njga7lhoXnqY1cbmFucz17JWQsJWR9XG4gICAseyVkLCVkfSIsYW5zWzBdWzBdLGFuc1swXVsxXSxhbnNbMV1bMF0sYW5zWzFdWzFdKTsKCXJldHVybiAwOwp9