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: Accepted

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

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

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

ci = []
for i in range(n):
    cij = []
    for k in range(l):
        s = 0
        for j in range (m):
            s += A[i][j] * B[j][k]
        cij.append(s)
    print(" ".join(map(str,cij)))

Submission status: Accepted

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

a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
c = [[0 for i in range(l)] for j in range(n)]

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

for i in range(m):
    mat_tmp = list(map(int,input().split()))
    for j in range(l):
        b[i][j] = mat_tmp[j]

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):
    print(' '.join(str(x) for x in c[i]))

Submission status: Accepted

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

first = []
second = []

for _ in range(n):
    first.append([int(x) for x in input().split(" ")])

for _ in range(m):
    second.append([int(x) for x in input().split(" ")])

res = []

for i in range(n):
    res.append([])
    for j in range(l):
        a = 0
        for k in range(m):
            a +=(first[i][k] * second[k][j])
        res[i].append(a)

for r in res:
    print(*r)

Submission status: Accepted

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

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

for i in range(n):
	A[i] = input().split()
for i in range (m):
	B[i] = input().split()

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])
			
[print(*row) for row in C]

Submission status: Accepted

Solution code:
A = []
B = []
C = []
n, m, l = map(int, input().strip().split())
[A.append(list(map(int, input().strip().split()))) for x in range(n)]
[B.append(list(map(int, input().strip().split()))) for y in range(m)]
[C.append([0 for zz in range(l)]) for z in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k]*B[k][j]
        if j == l - 1:
            print(C[i][j])
        else:
            print(C[i][j],end=' ')

Submission status: Accepted

Solution code:
N,M,L = (int(i) for i in 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)]
C = []
for i in range(N):
    for i2 in range(L):
        ans = 0
        for i3 in range(M):
            ans += A[i][i3]*B[i3][i2]
        if i2 == L-1:
            print(ans)
        else:
            print(ans,end=" ")

Submission status: Accepted

Solution code:
N,M,L = (int(i) for i in 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)]
for i in range(N):
    for i2 in range(L):
        ans = 0
        for i3 in range(M):
            ans += A[i][i3]*B[i3][i2]
        if i2 == L-1:
            print(ans)
        else:
            print(ans,end=" ")

Submission status: Accepted

Solution code:
r,cr,c = map(int,input().split())

matrix_a = [list(map(int,input().split())) for i in range(r)]
matrix_b = [list(map(int,input().split())) for i in range(cr)]
matrix_c = [ [0 for a in range(c)] for b in range(r)]

for j in range(r):
    for k in range(c):
        for l in range(cr):
            matrix_c[j][k] += matrix_a[j][l]*matrix_b[l][k]

for x in matrix_c:
    print(" ".join(list(map(str,x))))

Submission status: Accepted

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 = [[sum([a[i][k]*b[k][j] for k in range(m)]) for j in range(l)] for i in range(n)]
for i in range(n):
    print(" ".join(list(map(str, c[i]))))

Submission status: Accepted

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

import sys
import os


def input_to_list():
    return list(map(int, input().split()))

def get_column(M, i):
    lst = []
    for row in M:
        lst.append(row[i])
    return lst

def dot(lst0, lst1):
    if len(lst0) != len(lst1):
        print('error')
    else:
        s = 0
        for i in range(len(lst0)):
            s += lst0[i] * lst1[i]
        return s

n, m, l = input_to_list()

A = []
for i in range(n):
    A.append(input_to_list())

B = []
for i in range(m):
    B.append(input_to_list())

C = []
for i in range(n):
    C_row = []
    for j in range(l):
        row = A[i]
        col = get_column(B, j)
        C_row.append(dot(row, col))
    C.append(C_row)

# print
for row in C:
    print(*row)

Submission status: Accepted

Solution code:
n,m,l = [int(x) for x in input().split()]
matrix_a = [[int(x) for x in input().split()] for _ in range(n)]
matrix_b = [[int(x) for x in input().split()] for _ in range(m)]
matrix_ab = [[0 for a in range(l)] for b in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix_ab[i][j] += matrix_a[i][k]*matrix_b[k][j]
for i in range(n):
    for j in range(l):
        if j < l-1:
            print(matrix_ab[i][j], "", end="")
        elif j == l-1:
            print(matrix_ab[i][j])

Submission status: Accepted

Solution code:
from operator import mul
from itertools import starmap
 
n, m, l = map(int, input().split())
a, b = ([tuple(map(int, input().split())) for _ in range(k)] for k in (n, m))
for line in ([sum(starmap(mul, zip(ai, bj))) for bj in zip(*b)] for ai in a):
    print(*line)

Submission status: Accepted

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)]
C = [[0 for _ in range(l)] for _ in range(n)]

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):
    print(" ".join(str(x) for x in C[i]))

Submission status: Accepted

Solution code:
n,m,l = [int(i) for i in input().split()]
a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
for i in range(n):
	a[i] = [int(j) for j in input().split()]
for i in range(m):
	b[i] = [int(j) for j in input().split()]
c = [[0 for i in range(l)] for j in range(n)]
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 range(l-1):
		print(c[i][j],end=' ')
	print(c[i][l-1])

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
 
def func():
    try:
        (n,m,l) = [ int(item) for item in input().rstrip().split(" ") ]
        matrix_A = [ [ int(item) for item in input().rstrip().split(" ") ] for i in range(n) ]
        matrix_B = [ [ int(item) for item in input().rstrip().split(" ") ] for i in range(m) ]
    except:
        return inputError()
        
    matrix_C = [ [ sum([ matrix_A[i][j]*matrix_B[j][k] for j in range(m) ]) for k in range(l) ] for i in range(n) ]
    result=""

    for vector in matrix_C:
        for item in vector:
            result+=str(item)+" "
        result=result.rstrip()
        result+="\n"
    print(result.rstrip())

def inputError():
    '''
    print("input Error")
    return -1
    '''
 
    print("input Error")
    return -1
     
func()

Submission status: Accepted

Solution code:
#!/usr/bin/env python

nm = []
ml = []
nl = []

n, m, l = input().split()
n = int(n)
m = int(m)
l = int(l)

for i in range(n):
    r = input()
    rSplit = r.split()
    for j in range(m):
        rSplit[j] = int(rSplit[j])
    nm.append(rSplit)

for i in range(m):
    r = input()
    rSplit = r.split()
    for j in range(l):
        rSplit[j] = int(rSplit[j])
    ml.append(rSplit)

for i in range(n):
    nlrow = []
    for k in range(l):
        value = 0
        for j in range(m):
            value += nm[i][j]*ml[j][k]
        nlrow.append(value)
    nl.append(nlrow)

for i in range(n):
    for j in range(l):
        nl[i][j] = str(nl[i][j])

for x in nl:
    print(" ".join(x))

Submission status: Accepted

Solution code:
def func(amat, bmat, nm):
    ans = [[0 for i in range(nm[2])] for j in range(nm[0])]
    for i in range(nm[0]):
        for j in range(nm[1]):
            for l in range(nm[2]):
                ans[i][l] += amat[i][j] * bmat[j][l]
    for i in ans:
        print(' '.join(map(str, i)))


if __name__ == '__main__':
    nm = [int(i) for i in input().split(' ')]
    amat = [[0 for i in range(nm[1])] for j in range(nm[0])]
    bmat = [[0 for i in range(nm[2])] for i in range(nm[1])]

    for i in range(nm[0]):
        a = input().split(' ')
        for j in range(nm[1]):
            amat[i][j] = int(a[j])

    for i in range(nm[1]):
        b = input().split(' ')
        for j in range(nm[2]):
            bmat[i][j] = int(b[j])

    func(amat, bmat, nm)

Submission status: Accepted

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

Submission status: Accepted

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

AL = []
for i in range(n):
 ail = list(map(int,input().split()))
 AL.append(ail)

BL = []
for i in range(m):
 bil = list(map(int,input().split()))
 BL.append(bil)

for i in range(n):
 for j in range(l - 1):
  CI = 0
  for k in range(m):
   CI += AL[i][k] * BL[k][j]
  print(str(CI) + " ", end="")
 CI = 0
 for k in range(m):
  CI += AL[i][k] * BL[k][-1]
 print(str(CI))

Submission status: Accepted

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

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


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

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

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 c in C:
    print(' '.join([str(x) for x in c]))

Submission status: Accepted

Solution code:
a = [[0 for i in range(100)] for j in range(100)]
b = [[0 for i in range(100)] for j in range(100)]
n, m, l = map(int, input().split())
for i in range(n):
    a[i][:m] = map(int, input().split())
for i in range(m):
    b[i][:l] = map(int, input().split())
for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += a[i][k] * b[k][j]
        print(c, end='')
        if j < l - 1:
            print(' ', end='')
        else:
            print()

Submission status: Accepted

Solution code:
import copy
a = [[0 for i in range(100)] for j in range(100)]
b = copy.deepcopy(a)
n, m, l = map(int, input().split())
for i in range(n):
    a[i][:m] = map(int, input().split())
for i in range(m):
    b[i][:l] = map(int, input().split())
for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += a[i][k] * b[k][j]
        print(c, end='')
        if j < l - 1:
            print(' ', end='')
        else:
            print()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
#coding:utf-8
def seki(a, b):
    c = []
    gou = 0
    d = []
    for i in range(len(a)):
        for j in range(len(b[0])):
            for k in range(len(b)):
                gou += a[i][k] * b[k][j]

            d.append(gou)
            gou = 0

        c.append(d)
        d=[]
    return c

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

a = [list(map(int , input().rstrip().split())) for i in range(n)]
b = [list(map(int , input().rstrip().split())) for i in range(m)]

c = seki(a,b)

for i in c:
    print(" ".join(list(map(str,i))))

Submission status: Accepted

Solution code:
s = input().split(" ")
n = int(s[0])
m = int(s[1])
l = int(s[2])
a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
for i in range(n):
    s = input().split(" ")
    for j in range(m):
        a[i][j] = int(s[j])
for i in range(m):
    s = input().split(" ")
    for j in range(l):
        b[i][j] = int(s[j])
for i in range(n):
    for j in range(l):
        sk = 0
        for k in range(m):
            sk += a[i][k] * b[k][j]
        if j == l-1:
            print(sk)
        else:
            print(sk,end=" ")

Submission status: Accepted

Solution code:
n, m, l = map(int, raw_input().split())
matrix_a = []
matrix_b = []

for i in range(n):
    line = map(int, raw_input().split())
    matrix_a.append(line)
for i in range(m):
    line = map(int, raw_input().split())
    matrix_b.append(line)


for i in range(n):
    result = []
    for j in range(l):
        tmp = 0
        for k in range(m):
            tmp += matrix_a[i][k] * matrix_b[k][j]
        result.append(tmp)
    print " ".join(map(str, result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [[0 for i in range(100)] for j in range(100)]
b = [[0 for i in range(100)] for j in range(100)]
n, m, l = map(int, input().split())
for i in range(n):
    a[i][:m] = map(int, input().split())
for i in range(m):
    b[i][:l] = map(int, input().split())
for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += a[i][k] * b[k][j]
        if j == l-1:
            break
        print(c, end=' ')
    print(c)

Submission status: Accepted

Solution code:
a = [[0 for i in range(100)] for j in range(100)]
b = [[0 for i in range(100)] for j in range(100)]
n, m, l = map(int, input().split())
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = list(map(int, input().split()))
for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += a[i][k] * b[k][j]
        if j == l-1:
            break
        print(c, end=' ')
    print(c)

Submission status: Accepted

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

for i in range(n):
    for j in range(l):
        if j == l - 1:
            print(c[i][j])
        else:
            print("{0} ".format(c[i][j]), end = "")

Submission status: Accepted

Solution code:
n,m,l= map(int,input().split())
b=[]
A=[]
B=[]
for i in range(n):
        A1=list(map(int,input().split()))
        A.append(A1)
for i in range(m):
        B1=list(map(int,input().split()))
        B.append(B1)
C= [[0 for i in range(l)] for j in range(n)]
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):
    c=map(str,C[i])
    print(" ".join(c))

Submission status: Accepted

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 = [[sum([A[i][k] * B[k][j] for k in range(m)]) for j in range(l)] for i in range(n)]

for row in C:
    print(' '.join(map(str, row)))

Submission status: Accepted

Solution code:
n,m,l=[int(i) for i in input().split()]
x=[[int(0) for i in range(m)]for j in range(n)]
z=[[int(0) for i in range(l)]for j in range(n)]
y=[[int(0)for i in range(l)]for j in range(m)]
for i in range(n):
    k=input().split()
    for j in range(m):
        x[i][j]=int(k[j])
for i in  range(m):
    k=input().split()
    for j in range(l):
        y[i][j]=int(k[j])
        
for i in range(n):
    for j in range(l):
        count=int(0)
        for v in range(m):
            count=count+x[i][v]*y[v][j]
        z[i][j]=count
        
for i in range(n):
    for j in range(l-1):
        print(z[i][j],"",end="")
    print(z[i][l-1])

Submission status: Accepted

Solution code:
n,m,l = [int(s) for s in input().split(' ')]
A,B,C = [],[],[]
[A.append([int(s) for s in input().split(' ')]) for i in range(n)]
[B.append([int(s) for s in input().split(' ')]) for i in range(m)]

BT = [[row[i] for row in B] for i in range(l)]
for i in range(n):
	Ci = []
	for j in range(l):
		cij = sum([a*b for a,b in zip(A[i],BT[j])])
		Ci.append(cij)
	C.append(Ci)

C_s = [' '.join([str(i) for i in Ci]) for Ci in C]
[print(row) for row in C_s]

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
????????????
"""
inp = input().strip().split(" ")
n = int(inp[0])
m = int(inp[1])
l = int(inp[2])

# ?????????????????????????¢????
# A[n][m] B[m][l] C[n][l]
A = [[0 for i in range(m)] for j in range(n)]
B = [[0 for i in range(l)] for j in range(m)]
C = [[0 for i in range(l)] for j in range(n)]

# A???????????°??????????????????
for i in range(n):
    inp = input().strip().split(" ")
    for j in range(m):
        A[i][j] = int(inp[j])

# B???????????°??????????????????
for i in range(m):
    inp = input().strip().split(" ")
    for j in range(l):
        B[i][j] = int(inp[j])

# A x B
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
    print(" ".join(map(str,C[i])))

Submission status: Accepted

Solution code:
n,m,l = [eval(x) for x in input().split()]
mat_1 = [[eval(x) for x in input().split()] for _ in range(n)]
mat_2 = [[eval(x) for x in input().split()] for _ in range(m)]
res_mat = [[sum([mat_1[i][j]*mat_2[j][k] for j in range(m)]) for k in range(l)] for i in range(n)]
[print(*res_mat[i]) for i in range(n)]

Submission status: Accepted

Solution code:
def main():
    N, M, L = map(int, input().split())
    A = tuple(tuple(map(int, input().split())) for _ in range(N))
    B = tuple(tuple(map(int, input().split())) for _ in range(M))

    cell = 0
    row = []
    for n in range(N):
        for l in range(L):
            for m in range(M):
                cell += A[n][m] * B[m][l]
            row.append(cell)
            cell = 0
        print(*row, sep=' ')
        row = []

main()

Submission status: Accepted

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

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




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

for j in C:
    print(' '.join(map(str, j)))

Submission status: Accepted

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

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

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

for i in range(n):
    t=[]
    for k in range(l):
        s=0
        
        for j in range(m):
            s+=m_A[i][j]*m_B[j][k]
        t.append(s)
    print(*t)

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]

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

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

for i in range(n):
  line = []
  for j in range(l):
    c = 0
    for k in range(m):
      c += a[i][k]*b[k][j]
    line.append(str(c))
  print(' '.join(line))

Submission status: Accepted

Solution code:
n_max, m_max, l_max = (int(x) for x in input().split())
a = []
b = []
c = []

for n in range(n_max):
    a.append([int(x) for x in input().split()])

for m in range(m_max):
    b.append([int(x) for x in input().split()])

for n in range(n_max):
    c.append( [sum(a[n][m] * b[m][l] for m in range(m_max)) for l in range(l_max)])

for n in range(n_max):
    print(" ".join(str(c[n][l]) for l in range(l_max)))

Submission status: Accepted

Solution code:
n, m, l = list(map(int, input().split()))
A = []
B = []
C = []
for i in range(n):
    A.append(list(map(int, input().split())))
for i in range(m):
    B.append(list(map(int, input().split())))
for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(sum(A[i][k] * B[k][j] for k in range(m)))
for i in range(n):
    print(" ".join(list(map(str, C[i]))))

Submission status: Accepted

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

matrix_A = [list(map(int, input().split())) for _ in range(n)]
matrix_B = [list(map(int, input().split())) for _ in range(m)]

matrix_Bt = list(map(list, zip(*matrix_B)))

for a in matrix_A:
    r = []
    for bt in matrix_Bt:
        r.append(sum(x * y for (x, y) in zip(a, bt)))
    print(*r)

Submission status: Accepted

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 nnum in range(n):
    temp=[]
    for lnum in range(l):
        ret = 0
        for mnum in range(m):
            ret +=(A[nnum][mnum]*B[mnum][lnum])
        temp.append(ret)
    print(*temp)

Submission status: Accepted

Solution code:
n,m,l=map(int,input().split())
A = [tuple(map(int,input().split())) for _ in range(n)]
B = [tuple(map(int,input().split())) for _ in range(m)]
for nnum in range(n):
    temp=[]
    for lnum in range(l):
        ret = 0
        for mnum in range(m):
            ret +=(A[nnum][mnum]*B[mnum][lnum])
        temp.append(ret)
    print(*temp)

Submission status: Accepted

Solution code:
n,m,l=map(int,input().split())
A = [tuple(map(int,input().split())) for _ in range(n)]
B = [tuple(map(int,input().split())) for _ in range(m)]
BT = tuple(map(tuple,zip(*B)))
for a in A:
    temp=[]
    for b in BT:
        temp.append(sum([x*y for (x,y) in zip(a,b)]))
    print(*temp)

Submission status: Accepted

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

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

Submission status: Accepted

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)]
for i in range(n):
    C = []
    for j in range(l):
        c = 0
        for k in range(m):
            c += A[i][k] * B[k][j]
        C.append(c)
    print(*C)

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
A = [[int(n) for n in input().split()] for i in range(n)]
B = [[int(n) for n in input().split()] for i in range(m)]
C = [[0 for i in range(l)] for i in range(n)]
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 range(l):
        if j == l - 1:
            print(C[i][j])
        else:
            print(C[i][j], end = " ")

Submission status: Accepted

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

A, B = [], []
for ni in range(n):
    A.append(map(int, raw_input().split()))

for mi in range(m):
    B.append(map(int, raw_input().split()))

_B = list(map(list, zip(*B)))

for a in A:
    ret = []
    for b in _B:
        calc_result = 0
        for i, j in zip(a, b):
            calc_result += i*j
        ret += [calc_result]
    print "%s" % ' '.join(map(str, ret))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
a = [[int(num) for num in input().split()] for i in range(n)]
b = [[int(num) for num in input().split()] for i in range(m)]
c = [[0 for i in range(l)] for j in range(n)]
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 range(l):
        if j == l - 1:
            print(c[i][j])
        else:
            print(c[i][j], end=" ")

Submission status: Accepted

Solution code:
n,m,l = [int(i) for i in 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(l)] for j in range(n)]
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):
    print(' '.join(map(str,c[i])))

Submission status: Accepted

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

nm = []
ml = []

for _ in range(n):
	lista = list(map(int, input().split()))
	nm.append(lista)

for _ in range(m):
	lista = list(map(int, input().split()))
	ml.append(lista)
	
matrix = []

for i in range(n):
	lista = []
	for j in range(l):
		sum = 0
		for k in range(m):
			sum += nm[i][k]*ml[k][j]
		lista.append(sum)
	matrix.append(lista)

for i in range(n):
	text = ""
	for j in range(l):
		text += str(matrix[i][j]) + " "
	print(text[:-1])

Submission status: Accepted

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

a = [[0 for i2 in range(m)] for i1 in range(n)]
b = [[0 for i2 in range(l)] for i1 in range(m)]
c = [[0 for i2 in range(l)] for i1 in range(n)]

for i in range(n):
    A = input().split()
    for j in range(m):
        a[i][j] = int(A[j])

for i in range(m):
    B = input().split()
    for j in range(l):
        b[i][j] = int(B[j])

for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]
        print(str(c[i][j]), end = '')
        if j != l - 1:
            print(' ', end = '')
    print()

Submission status: Accepted

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

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

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

for i in range(n):
    output = []
    for j in range(l):
        temp = 0
        for k in range(m):
            temp += A[i][k] * B[k][j]
        output.append(temp)
    print(*output)

Submission status: Accepted

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

matrix_A = [list(map(int, input().split())) for i in range(n)]
matrix_B = [list(map(int, input().split())) for i in range(m)]
output_matrix = [[0 for i in range(l)] for j in range(n)]
for i in range(m):
    for j in range(l):
        for k in range(n):
            output_matrix[k][j] += matrix_A[k][i] * matrix_B[i][j]

for  tmp_list in output_matrix:
    print(" ".join(map(str, tmp_list)))

Submission status: Accepted

Solution code:
from itertools import islice

def make_seq():
    n, m, l = list(map(int, input().split()))

    m1 = [list(map(int, input().split())) for _ in range(n)]
    m2 = [list(map(int, input().split())) for _ in range(m)]

    def g():
        for r1 in m1:
            for r2 in zip(*m2):
                yield str(sum(i*j for i, j in zip(r1, r2)))

    return (n, l, list(g()))

n, l, lst = make_seq()
for i in range(n):
    print(" ".join(islice(lst, i*l, (i+1)*l)))

Submission status: Accepted

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

Submission status: Accepted

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)]

for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += a[i][k]*b[k][j]
        print(c,end="")
        if j != l-1:
            print("",end=" ")
    print()

Submission status: Accepted

Solution code:
l, m, n = map(int,input().split())
a = [[0 for i in range(m)] for i in range(l)]
b = [[0 for i in range(n)] for i in range(m)]
c = [[0 for i in range(n)] for i in range(l)]

for i in range(l):
 a[i] = [int(x) for x in input().split()]

for i in range(m):
 b[i] = [int(x) for x in input().split()]

for i in range(l):
 for j in range(n):
  for k in range(m):
   c[i][j] += (a[i][k] * b[k][j])
 print(" ".join([str(x) for x in c[i]]))

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
A, B = [list(map(int, input().split())) for r in range(n)], [list(map(int, input().split())) for r in range(m)]
for i in range(n):
    for j in range(l):
        Cij = 0
        for k in range(m):
            Cij += A[i][k]*B[k][j]
        if j < l-1:
            print('%d' %(Cij), end=' ')
        else:
            print('%d' % (Cij))