A - Determinant
Editorial
/
Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
2 \times 2 行列 A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} が与えられます。
A の行列式は ad-bc で求められます。
A の行列式を求めてください。
制約
- 入力は全て整数
- -100 \le a, b, c, d \le 100
入力
入力は以下の形式で標準入力から与えられる。
a b c d
出力
答えを整数で出力せよ。
入力例 1
1 2 3 4
出力例 1
-2
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} の行列式は 1 \times 4 - 2 \times 3 = -2 です。
入力例 2
0 -1 1 0
出力例 2
1
入力例 3
100 100 100 100
出力例 3
0
Score : 100 points
Problem Statement
Given is a 2 \times 2 matrix A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}.
The determinant of A can be found as ad-bc.
Find it.
Constraints
- All values in input are integers.
- -100 \le a, b, c, d \le 100
Input
Input is given from Standard Input in the following format:
a b c d
Output
Print the answer as an integer.
Sample Input 1
1 2 3 4
Sample Output 1
-2
The determinant of \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} is 1 \times 4 - 2 \times 3 = -2.
Sample Input 2
0 -1 1 0
Sample Output 2
1
Sample Input 3
100 100 100 100
Sample Output 3
0