Limits 1s, 512 MB

Given two 2×22\times2 matrices, calculate the product of the two matrices.

The product of two 2×22\times2 matrices will produce another 2×22\times2 matrix where:

A = [ A₁₁ A₁₂
      A₂₁ A₂₂ ]
B = [ B₁₁ B₁₂
      B₂₁ B₂₂ ]
C = A × B = [ C₁₁ C₁₂
              C₂₁ C₂₂ ]
C₁₁ = A₁₁ ×  B₁₁ + A₁₂ × B₂₁
C₁₂ = A₁₁ ×  B₁₂ + A₁₂ × B₂₂
C₂₁ = A₂₁ ×  B₁₁ + A₂₂ × B₂₁
C₂₂ = A₂₁ ×  B₁₂ + A₂₂ × B₂₂

For example:

A = [ 2 3
      4 5 ]
B = [ 5 6
      7 8 ]
C = A × B = [ 31 36
              55 64 ]

Input

The input contains two matrices as follows:

A₁₁ A₁₂
A₂₁ A₂₂
B₁₁ B₁₂
B₂₁ B₂₂

The value of each of these 8 integers is non-negative and less than 100.

Output

Print the product of the two matrices as follows:

C₁₁ C₁₂
C₂₁ C₂₂

Submit

Login to submit.

Statistics

94% Solution Ratio
YouKnowWhoEarliest, Mar '19
YouKnowWhoFastest, 0.0s
N550999.Lightest, 0 B
Nusab19Shortest, 104B
Toph uses cookies. By continuing you agree to our Cookie Policy.