CODEVS1287 矩阵乘法
基础的矩阵乘法。
Program CODEVS1287; const maxn=208; var k1,k2,k3,sum:int64; a,b,c:array[0..maxn,0..maxn] of int64; i,j,k:longint; begin readln(k1,k2); for i:=1 to k1 do for j:=1 to k2 do read(a[i,j]); readln(k2,k3); for i:=1 to k2 do for j:=1 to k3 do read(b[i,j]); for i:=1 to k1 do for j:=1 to k3 do begin sum:=0; for k:=1 to k2 do sum:=sum+a[i,k]*b[k,j]; c[i,j]:=sum; end; for i:=1 to k1 do begin for j:=1 to k3 do write(c[i,j],' '); writeln; end; end.