2x2 Matrix Multiply

2x2 Matrix Multiply

Medium Computer Mathematics Matrices 24 views
Explanation Complexity

Problem Statement

Multiply two 2x2 matrices.

Input Format

Eight integers a11 a12 a21 a22 b11 b12 b21 b22.

Output Format

Four integers of product row-wise.

Example

1 2 3 4 5 6 7 8
19 22 43 50

Constraints

Values fit 64-bit

Input / Output Format

Input Format
Eight integers a11 a12 a21 a22 b11 b12 b21 b22.
Output Format
Four integers of product row-wise.
Constraints
Values fit 64-bit

Examples

Input:
1 2 3 4 5 6 7 8
Output:
19 22 43 50

Example Solution (Public)

Computer Mathematics
Compute c11=a11*b11+a12*b21, c12=a11*b12+a12*b22, c21=a21*b11+a22*b21, c22=a21*b12+a22*b22.

Official Solution Code

Compute c11=a11*b11+a12*b21, c12=a11*b12+a12*b22, c21=a21*b11+a22*b21, c22=a21*b12+a22*b22.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.