Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Matrix Multiplication

Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula:

\[
c_{ij} = \sum_{k=1}^m a_{ik}b_{kj}
\]

  where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ respectively.

Input

  In the first line, three integers $n$, $m$ and $l$ are given separated by space characters

  In the following lines, the $n \times m$ matrix $A$ and the $m \times l$ matrix $B$ are given.

Output

  Print elements of the $n \times l$ matrix $C$ ($c_{ij}$). Print a single space character between adjacent elements.

Constraints

$1 \leq n, m, l \leq 100$

$0 \leq a_{ij}, b_{ij} \leq 10000$

Sample Input

3 2 3
1 2
0 3
4 5
1 2 1
0 3 2

Sample Output

1 8 5
0 9 6
4 23 14

Note

      解説      

	



Sample input:
3 2 3
1 2
0 3
4 5
1 2 1
0 3 2


Sample output:
1 8 5
0 9 6
4 23 14

Submission status: Runtime Error

Solution code:
lis=input().split()
n=int(lis[0])
m=int(lis[1])
l=int(lis[2])

# for input A(n*m)
i=0
A=[]
while i<n:
    p=0
    a=input().split()
    while p<m:
        A.append(int(a[p]))
        p+=1
    i+=1

# for input B(m*l)
v=0
B=[]
while v<m:
    q=0
    b=input().split()
    while q<l:
        B.append(int(b[q]))
        q+=1
    v+=1

# for caluculate
#cij=ai1b1j+ai2b2j+...aimbmj
#aik=A[m*i+k-1]
#bkj=B[l*k+j-1]
j=0
c=[]
while j<l:
    h=0
    while h<n:
        cjh=0
        k=0
        while k<m:
            cjh+=A[m*j+k]*B[l*k+h]
            k=k+1
        c.append(cjh)
        h+=1
    j+=1

#for output
f=0
C=[]
while f<n:
    g=0
    ans=str(c[l*f])
    while g<l-1:
        g=g+1
        ans+=" "+str(c[l*f+g])
    C.append(ans)
    f+=1

for pap in C:
    print(pap)

Submission status: Runtime Error

Solution code:
lis=input().split()
n=int(lis[0])
m=int(lis[1])
l=int(lis[2])

# for input A(n*m)
i=0
A=[]
while i<n:
    p=0
    a=input().split()
    while p<m:
        A.append(int(a[p]))
        p+=1
    i+=1

# for input B(m*l)
v=0
B=[]
while v<m:
    q=0
    b=input().split()
    while q<l:
        B.append(int(b[q]))
        q+=1
    v+=1

# for caluculate
#cij=ai1b1j+ai2b2j+...aimbmj
#aik=A[m*i+k-1]
#bkj=B[l*k+j-1]
j=0
c=[]
while j<l:
    h=0
    while h<n:
        cjh=0
        k=0
        while k<m:
            cjh+=A[m*j+k]*B[l*k+h]
            k=k+1
        c.append(cjh)
        h+=1
    j+=1

#for output
f=0
C=[]
while f<n:
    g=0
    ans=str(c[l*f])
    while g<l-1:
        g=g+1
        ans+=" "+str(c[l*f+g])
    C.append(ans)
    f+=1

for pap in C:
    print(pap)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main(){
	int n, m, l;
	vector< vector<long> > matlix1, matlix2, ans;
	cin >> n >> m >> l;
	for(int y = 0; y < n; y++){
		vector<long> tmp;
		for(int x = 0; x < m; x++){
			long num;
			cin >> num;
			tmp.push_back(num);
		}
		matlix1.push_back(tmp);
	}
	for(int y = 0; y < m; y++){
		vector<long> tmp;
		for(int x = 0; x < l; x++){
			long num;
			cin >> num;
			tmp.push_back(num);
		}
		matlix2.push_back(tmp);
	}
	for(int i = 0; i < n; i++){
		vector<long> tmp;
		for(int j = 0; j < l; j++){
			long mul = 0;
			for(int k = 0; k < m; k++){
				mul += matlix1[i][k] * matlix2[k][j];
			}
			tmp.push_back(mul);
		}
		ans.push_back(tmp);
	}
	for(int y = 0; y < n; y++){
		for(int x = 0; x < l; x++){
			cout << ans[y][x];
			if(x < l - 1) cout << ' ';
		}
		if(y < n) cout << '\n';
	}
}

Submission status: Runtime Error

Solution code:
n, m, l = map(int,input().split())
a = [list(map(int, input().split()))for i in range(n)]
b = [list(map(int, input().split()))for j in range(m)]
num = [[0 for i in range(n)]for j in range(l)]
for k in range(n):
    for i in range(l):
        for j in range(m):
            num[k][i] += a[k][j] * b[j][i]
for i in range(n):
    print(" ".join(map(str, num[i])))

Submission status: Runtime Error

Solution code:
n, m, l = map(int,input().split())
a = [list(map(int, input().split()))for i in range(n)]
b = [list(map(int, input().split()))for j in range(m)]
num = [[0 for i in range(l)]for j in range(n)]
for k in range(n):
    for i in range(l):
        for j in range(m):
            num[k][i] += a[k][j] * b[j][i]
for i in range(n):
    print(" ".join(map(num[i])))

Submission status: Runtime Error

Solution code:
n, m, l = map(int, input().split())
A, B = [], []
C = [[0 for i in range(n)] for j in range(l)]

for i in range(n):
    A.append([int(i) for i in input().split()])

for i in range(m):
    B.append([int(i) for i in input().split()])

B = list(zip(*B))

for i, line_A in enumerate(A):
    for j, line_B in enumerate(B):
        for x, y in zip(line_A, line_B):
            C[i][j] += x * y

for line in C:
    for i, x in enumerate(line):
        if i == l - 1:
            print(x)
        else:
            print(x, end=" ")

Submission status: WA: Presentation Error

Solution code:
def main():
    n, m, l = tuple(map(int, input().split()))
    matA = [[0 for j in range(m)] for i in range(n)]
    matB = [[0 for k in range(l)] for j in range(m)]
    matC = [[0 for k in range(l)] for i in range(n)]

    for i in range(n):
        tmp = list(map(int, input().split()))
        for j in range(m):
            matA[i][j] = tmp[j]

    for j in range(m):
        tmp = list(map(int, input().split()))
        for k in range(l):
            matB[j][k] = tmp[k]


    for i in range(n):
        for k in range(l):
            for j in range(m):
                matC[i][k] += matA[i][j] * matB[j][k]

    for i in range(n):
        for k in range(l):
            print(matC[i][k], end=' ')
        print()

if __name__ == '__main__':
    main()

Submission status: WA: Presentation Error

Solution code:
n, m, l = map(int, input().split())
A = []
B = []
for _ in range(n):
    A.append(list(map(int, input().split())))
for _ in range(m):
    B.append(list(map(int, input().split())))
C = [[0 for _ in range(l)] for _ in range(n)]
for i in range(n):
    for j in range(l):
        s = 0
        for k in range(m):
            s += A[i][k] * B[k][j]
        C[i][j] = s

for row in C:
    count = 0
    for i in row:
        if count != l - 1:
            print('{} '.format(i), end = '')
        else:
            print('{}'.format(i), end = '')
    print('')

Submission status: WA: Presentation Error

Solution code:
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
    for j in range(l):
        print(sum([a[i][k]*b[k][j] for k in range(m)]), end=" ")
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())

YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        print(GOMI,end=" ")
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        print(GOMI,end=" ")
    if i!=n:
        print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        print(GOMI,end=" ")

    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:
            print(GOMI,end=" ")
        else:
            print(GOMI)
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:
            print(GOMI,end=" ")
        else:
            print(GOMI)
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:
            print(GOMI,end=" ")
        else:print(GOMI)
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:print(GOMI,end=" ")
        else:print(GOMI)
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:
            print(GOMI,end=" ")
        else:
            print(GOMI)
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:
            print(GOMI,end=" ")
        else:
            print(GOMI,end="")
    print()

Submission status: WA: Presentation Error

Solution code:
n, m, l = map(int, input().split())

def get_matrix(n):
	matrix = []
	for i in range(n):
		matrix.append(list(map(int, input().split())))
	return matrix

A = get_matrix(n)
B = get_matrix(m)

for i in range(n):
	for j in range(l):
		sum = 0
		for k in range(m):
			sum += A[i][k]*B[k][j]
		print(sum, end=' ')
	print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
matrixL = [[0]*m for i in range(n)]
matrixR = [[0]*l for i in range(m)]
for row in range(n):
    matrixL[row] = [int(i) for i in input().split()]

for row in range(m):
    matrixR[row] = [int(i) for i in input().split()]
c = [[0] * l for i in range(n)]
for ansColumn in range(l):
    for row in range(n):
        for column in range(m):
            c[row][ansColumn] = c[row][ansColumn] + matrixL[row][column] * matrixR[column][ansColumn]
for row in range(n):
    for column in range(l):
        print("%d " %c[row][column], end ="")
        if column == l -1:
            print("")

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    for j in range(l):
        print("%d "%(matrix[i][j]), end = "")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    for j in range(l):
        print(" %d "%(matrix[i][j]), end = "")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    for j in range(l):
        print("%d"%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    for j in range(l):
        print("%d "%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    for j in range(l):
        print("%d  "%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    print("%d"%matrix[i][0], end = "")
    for j in range(1, l):
        print("%d  "%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    print("%d"%matrix[i][0], end = "")
    for j in range(1, l):
        print(" %d"%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for j in range(m)]
matrix = [[0]*(n) for k in range(l)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += A[i][k] * B[k][j]

for i in range(n):
    print("%d"%matrix[i][0], end = "")
    for j in range(1, l):
        print(" %d"%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
#coding: UTF-8
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

n, m, l = list(map(int, input().split())) # 3 2 3

A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for j in range(m)]
matrix = [[0]*(l) for k in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += A[i][k] * B[k][j]

for i in range(n):
    print("%d"%matrix[i][0], end = "")
    for j in range(1, l):
        print(" %d"%(matrix[i][j]), end = " ")
    print()

Submission status: WA: Presentation Error

Solution code:
n, m, l = map(int, input().split())

A = [list(map(int,input().split())) for i in range(n)]

B = [list(map(int,input().split())) for i in range(m)]

C = [[0 for i in range(l)] for j in range(n)]

for i in range(0, n):
  for j in range(0, l):
    for k in range(0, m):
      C[i][j] = C[i][j] + A[i][k] * B[k][j] 

for i in range(0, n):
  for j in range(0, l):
    print(C[i][j],"", end="")
  print()

Submission status: WA: Presentation Error

Solution code:
n, m, l = map(int, input().split())

A = [list(map(int,input().split())) for i in range(n)]

B = [list(map(int,input().split())) for i in range(m)]

C = [[0 for i in range(l)] for j in range(n)]

for i in range(0, n):
  for j in range(0, l):
    for k in range(0, m):
      C[i][j] = C[i][j] + A[i][k] * B[k][j] 

for i in range(0, n):
  print(*C[i])
print()

Submission status: WA: Presentation Error

Solution code:
n,m,l=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]
B=[list(map(int,input().split())) for i in range(m)]
#print(A)
#print(B)

for i in range(n):
  for j in range(l):
    youso=0
    for k in range(m):
      youso+=A[i][k]*B[k][j]
    if l==0:
      print(youso,end="")
    else:
      print("",youso,end="")
  print("")

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,raw_input().split(' '))
A = [ [0 for j in range(m)]for i in range(n)]
B = [ [0 for j in range(l)]for i in range(m)]
for i in range(n):
	A[i] = map(int,raw_input().split(' '))
for i in range(m):
	B[i] = map(int,raw_input().split(' '))		
for i in range(n):
	for j in range(l):
		sum = 0
		for k in range(m):
			sum += A[i][k]*B[k][j]
		print sum,
	print ""

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,raw_input().split(' '))
A = [ [0 for j in range(m)]for i in range(n)]
B = [ [0 for j in range(l)]for i in range(m)]
for i in range(n):
	A[i] = map(int,raw_input().split(' '))
for i in range(m):
	B[i] = map(int,raw_input().split(' '))		
for i in range(n):
	for j in range(l):
		sum = 0
		for k in range(m):
			sum += A[i][k]*B[k][j]
		print sum,
	if i < n-1 :
		print ""

Submission status: WA: Presentation Error

Solution code:
n,m,l = [int(x) for x in raw_input().split()]

A = []
for idx in range(0,n):
    A.append([int(x) for x in raw_input().split()])

B = []
for idx in range(0,m):
    B.append([int(x) for x in raw_input().split()])

for line in range(0, n):
    result_list = []
    for idx1 in range(0, l):
        sum = 0
        for idx2 in range(0, m):
            sum += A[line][idx2] * B[idx2][idx1]
        result_list.append(sum)
    
    result_str = ""
    for result in result_list:
        result_str += str(result) + " "
    print result_str

Submission status: WA: Presentation Error

Solution code:
n,m,l = [int(x) for x in raw_input().split()]

A = []
for idx in range(0,n):
    A.append([int(x) for x in raw_input().split()])

B = []
for idx in range(0,m):
    B.append([int(x) for x in raw_input().split()])

for line in range(0, n):
    result_list = []
    for idx1 in range(0, l):
        sum = 0
        for idx2 in range(0, m):
            sum += A[line][idx2] * B[idx2][idx1]
        result_list.append(sum)
    
    result_str = ""
    for result in result_list:
        result_str += str(result) + " "
    print result_str + "\n"

Submission status: WA: Presentation Error

Solution code:
( n, m, l) = [ int(i) for i in input().split()]

# input to list
a = []
b = []
for an in range(n):
    a.append( [ int(i) for i in input().split()])
for bn in range(m):
    b.append( [ int(i) for i in input().split()])

# output
for cn in range(n):
    for cl in range(l):
        print( a[cn][0] * b[0][cl] + a[cn][1] * b[1][cl], end=' ')
    print()

Submission status: WA: Presentation Error

Solution code:
n, m, l = map(int, input().split())
A = []
B = []
for _ in range(n):
    A.append(list(map(int, input().split())))
for _ in range(m):
    B.append(list(map(int, input().split())))

for i in range(n):
    for j in range(l):
        s = 0
        for k in range(m):
            s += A[i][k] * B[k][j]
        print(s, end=' ')
    print()

Submission status: WA: Presentation Error

Solution code:
# -*- coding: utf-8 -*-

mat1 = {}
mat2 = {}

n, m, l = map(int, raw_input().split())
for i in range(1, n+1):
    list = map(int, raw_input().split())
    for j in range(1, m+1):
        mat1[(i, j)] = list[j-1]

for j in range(1, m+1):
    list = map(int, raw_input().split())
    for k in range(1, l+1):
        mat2[(j, k)] = list[k-1]

for i in range(1, n+1):
    buf = ""
    for k in range(1, l+1):
        res = 0
        for j in range(1, m+1):
            res += mat1[(i, j)]*mat2[(j, k)]
        buf += str(res) +" "
    buf.rsplit()
    print buf

Submission status: WA: Presentation Error

Solution code:
# -*- coding: utf-8 -*-

mat1 = {}
mat2 = {}

n, m, l = map(int, raw_input().split())
for i in range(1, n+1):
    list = map(int, raw_input().split())
    for j in range(1, m+1):
        mat1[(i, j)] = list[j-1]

for j in range(1, m+1):
    list = map(int, raw_input().split())
    for k in range(1, l+1):
        mat2[(j, k)] = list[k-1]

for i in range(1, n+1):
    buf = ""
    for k in range(1, l+1):
        res = 0
        for j in range(1, m+1):
            res += mat1[(i, j)]*mat2[(j, k)]
        buf += str(res) +" "
#    buf.rsplit()
    print buf

Submission status: WA: Presentation Error

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    for j in range(l):
        print("{0} ".format(C[i][j]), end="")
    print("")

Submission status: WA: Presentation Error

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    for j in range(l):
        print("{0}".format(C[i][j]), end=" ")
    print("")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))

Submission status: WA: Presentation Error

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    for j in range(l):
        print("{0}".format(C[i][j]), end=" ")
    print("")
print("")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))

Submission status: WA: Presentation Error

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    for j in range(l):
        print("{0}".format(C[i][j]), end=" ")
    print("\n")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))

Submission status: WA: Presentation Error

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    for j in range(l):
        print("{0}".format(C[i][j]), end=" ")
    print()

Submission status: WA: Presentation Error

Solution code:
NML = input().split()
n = int(NML[0])
m = int(NML[1])
l = int(NML[2])

A = []
B = []
for i in range(n):
    A.append([])
    A_r = input().split()
    for j in range(m):
        A[i].append(int(A_r[j]))
for i in range(m):
    B.append([])
    B_r= input().split()
    for j in range(l):
        B[i].append(int(B_r[j]))
for i in range(n):
    for j in range(l):
        out=0
        for k in range(m):
            out +=A[i][k]*B[k][j]
        print(str(out)+" ",end="")
    print("")

Submission status: WA: Presentation Error

Solution code:
n,m,l = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(n)]
B = [map(int,input().split()) for i in range(m)]
B_T = list(map(list, zip(*B)))
for a in A:
    for b in B_T:
        print(sum([x*y for (x,y) in zip(a,b)]),end = '')
        print(' ',end = '')
    print('')

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,raw_input().split())

A = []
B = []
AB = [[]for i in range(n)]
for i in range(n):
    A.append(map(int,raw_input().split()))
for j in range(m):
    B.append(map(int,raw_input().split()))

for i in range(n):
    for k in range(l):
        sum = 0
        for j in range(m):
            sum += A[i][j]* B[j][k]
        AB[i].append(sum)
for i in range(n):
    print ("{}".format(AB[i]).replace("[","").replace(","," ").replace("]",""))

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
A = [[int(i) for i in input().split()] for i in range(n)]
B = [[int(i) for i in input().split()] for i in range(m)]
result = [[0 for i in range(l)] for i in range(n)]

for i in range(n):
    for j in range(m):
        for k in range(l):
            result[i][k] += A[i][j] * B[j][k]

for i in range(n):
    for j in result[i]:
        print(j, end=" ")
    print()

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
A = []
for i in range(n):
    a = [int(j) for j in input().split()]
    A.append(a)
B = []
for j in range(m):
    b = [int(k) for k in input().split()]
    B.append(b)
    
for i in range(n):
    for k in range(l):
        x = 0
        for j in range(m):
            x += A[i][j]*B[j][k]
        print(x, end=" ")
    print("")

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
A = []
for i in range(n):
    a = [int(j) for j in input().split()]
    A.append(a)
B = []
for j in range(m):
    b = [int(k) for k in input().split()]
    B.append(b)
    
for i in range(n):
    for k in range(l):
        x = 0
        for j in range(m):
            x += A[i][j]*B[j][k]
        print(x, end="")
        if j == range(m-1):
            continue
        print(" ", end="")
    print("")

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
A = []
for i in range(n):
    a = [int(j) for j in input().split()]
    A.append(a)
B = []
for j in range(m):
    b = [int(k) for k in input().split()]
    B.append(b)
    
for i in range(n):
    for k in range(l):
        x = 0
        for j in range(m):
            x += A[i][j]*B[j][k]
        print(x, end="")
        if k == range(l-1):
            continue
        print(" ", end="")
    print("")

Submission status: WA: Presentation Error

Solution code:
import sys

def input_number():
    for i in range(n):
        adding=map(int,raw_input().split())
        A.append(adding)
    for i in range(m):
        adding=map(int,raw_input().split())
        B.append(adding)

if __name__ == '__main__':
    n,m,l=map(int,raw_input().split())
    A=[]
    B=[]
    ans=[[0 for i in range(n)]for j in range(l)]
    input_number()
    for i in range(n):
        for j in range(l):
            for k in range(m):
                ans[i][j] += A[i][k] * B[k][j]
    for i in range(n):
        for j in range(l):
            sys.stdout.write("%d" % ans[i][j])
            sys.stdout.write(" ")
        sys.stdout.write("\n")

Submission status: WA: Presentation Error

Solution code:
import sys

def input_number():
    for i in range(n):
        adding=map(int,raw_input().split())
        A.append(adding)
    for i in range(m):
        adding=map(int,raw_input().split())
        B.append(adding)

if __name__ == '__main__':
    n,m,l=map(int,raw_input().split())
    A=[]
    B=[]
    ans=[[0 for i in range(n)]for j in range(l)]
    input_number()
    for i in range(n):
        for j in range(l):
            for k in range(m):
                ans[i][j] += A[i][k] * B[k][j]
    for i in range(n):
        for j in range(l):
            sys.stdout.write("%d" % ans[i][j])
            if j != l-1:
                sys.stdout.write(" ")

        if i != n-1:
            sys.stdout.write("\n")

Submission status: WA: Presentation Error

Solution code:
n,m,l = map(int,input().split())
A = [[int(i) for i in input().split()] for j in range(n)]
B = [[int(i) for i in input().split()] for j in range(m)]
C = [[0 for i in range(n)] for k in range(l)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k]*B[k][j]
for i in range(n):
    for j in C[i]:
        print(j,end=" ")
    print()