/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
高橋君は、大学の線形代数の授業で内積の計算練習をしています。
7 次元のベクトル \mathbf{a} = (A_1, A_2, \ldots, A_7) と \mathbf{b} = (B_1, B_2, \ldots, B_7) が与えられるので、これらの内積 \mathbf{a} \cdot \mathbf{b} = A_1 \times B_1 + A_2 \times B_2 + \cdots + A_7 \times B_7 を求めてください。
制約
- -100 \leq A_i \leq 100 (1 \leq i \leq 7)
- -100 \leq B_i \leq 100 (1 \leq i \leq 7)
- 入力はすべて整数である。
入力
A_1 A_2 A_3 A_4 A_5 A_6 A_7 B_1 B_2 B_3 B_4 B_5 B_6 B_7
- 1 行目には、ベクトル \mathbf{a} の各成分を表す 7 個の整数 A_1, A_2, \ldots, A_7 がスペース区切りで与えられる。
- 2 行目には、ベクトル \mathbf{b} の各成分を表す 7 個の整数 B_1, B_2, \ldots, B_7 がスペース区切りで与えられる。
出力
2 つのベクトルの内積 A_1 \times B_1 + A_2 \times B_2 + \cdots + A_7 \times B_7 の値を 1 行で出力してください。
入力例 1
1 2 3 4 5 6 7 1 1 1 1 1 1 1
出力例 1
28
入力例 2
3 -1 4 1 -5 9 2 2 7 -1 8 2 -3 6
出力例 2
-22
入力例 3
100 -100 100 -100 100 -100 100 100 100 -100 -100 100 100 -100
出力例 3
-10000
Score : 200 pts
Problem Statement
Takahashi is practicing dot product calculations in his university linear algebra class.
Given two 7-dimensional vectors \mathbf{a} = (A_1, A_2, \ldots, A_7) and \mathbf{b} = (B_1, B_2, \ldots, B_7), compute their dot product \mathbf{a} \cdot \mathbf{b} = A_1 \times B_1 + A_2 \times B_2 + \cdots + A_7 \times B_7.
Constraints
- -100 \leq A_i \leq 100 (1 \leq i \leq 7)
- -100 \leq B_i \leq 100 (1 \leq i \leq 7)
- All inputs are integers.
Input
A_1 A_2 A_3 A_4 A_5 A_6 A_7 B_1 B_2 B_3 B_4 B_5 B_6 B_7
- The first line contains 7 integers A_1, A_2, \ldots, A_7 separated by spaces, representing the components of vector \mathbf{a}.
- The second line contains 7 integers B_1, B_2, \ldots, B_7 separated by spaces, representing the components of vector \mathbf{b}.
Output
Print the value of the dot product of the two vectors, A_1 \times B_1 + A_2 \times B_2 + \cdots + A_7 \times B_7, on a single line.
Sample Input 1
1 2 3 4 5 6 7 1 1 1 1 1 1 1
Sample Output 1
28
Sample Input 2
3 -1 4 1 -5 9 2 2 7 -1 8 2 -3 6
Sample Output 2
-22
Sample Input 3
100 -100 100 -100 100 -100 100 100 100 -100 -100 100 100 -100
Sample Output 3
-10000