問題一覧 > 通常問題

No.3224 Introduction to 2×2 Matrices

レベル : / AI推定難易度 : 115 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 102
作問者 : ジュ・ビオレ・グレイス / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 12484 / 自分の提出
問題文最終更新日: 2025-07-19 19:02:19
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 477 線形代数コンテスト (順位表) の他の問題:

Problem Statement

You are given integers $A, B, C, D, A', B', C', D'$ from the input. Define the $2\times 2$ matrices $M, M'$ respectively as

$M = \begin{pmatrix} A & B \\ C & D \end{pmatrix}, \ M' = \begin{pmatrix} A' & B' \\ C' & D' \end{pmatrix}$

. Find the matrix product

$M M' M M' = \begin{pmatrix} W & X \\ Y & Z \end{pmatrix}$

.

About the matrix product The product of $2 \times 2$ matrices is defined as

$\begin{pmatrix} a_{1, 1} & a_{1, 2} \\ a_{2, 1} & a_{2, 2} \end{pmatrix} \begin{pmatrix} b_{1, 1} & b_{1, 2} \\ b_{2, 1} & b_{2, 2} \end{pmatrix} = \begin{pmatrix} a_{1, 1} b_{1, 1} + a_{1, 2}b_{2, 1} & a_{1, 1}b_{1, 2} + a_{1, 2}b_{2, 2} \\ a_{2, 1}b_{1, 1} + a_{2, 2}b_{2, 1} & a_{2, 1}b_{1, 2} + a_{2, 2}b_{2, 2} \end{pmatrix}$

. The matrix product satisfies the associative law. That is, $M(NL) = (MN)L$.

Input

$A \ B \\ C \ D \\ A' \ B' \\ C' \ D'$

All integers given in the input are between $-10^4$ and $10^4$, inclusive.

Output

Output $W, X, Y, Z$ defined in the problem statement in the following format:

$W \ X \\ Y \ Z$
Print a newline at the end.

Sample

Sample 1
Input
1 0
0 1
2 3
4 5
Output
16 21
28 37

$\begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \begin{pmatrix} 2 & 3 \\ 4 & 5 \end{pmatrix} = \begin{pmatrix}2 & 3 \\ 4 & 5\end{pmatrix},$
$\begin{pmatrix} 2 & 3 \\ 4 & 5 \end{pmatrix} \begin{pmatrix} 2 & 3 \\ 4 & 5 \end{pmatrix} = \begin{pmatrix} 2\times 2 + 3 \times 4 & 2 \times 3 + 3 \times 5 \\ 4 \times 2 + 5 \times 4 & 4 \times 3 + 5 \times 5 \end{pmatrix} = \begin{pmatrix}16 & 21 \\ 28 & 37\end{pmatrix} $

Sample 2
Input
1 -2
3 4
-5 -6
7 8
Output
75 110
-65 -90

Sample 3
Input
10000 9797
1234 9876
9898 8989
1717 7777
Output
18254769490702857 33830675938859763
5942164530811048 12570866016297340

The answer may not fit in a 32-bit integer.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。