#B2091. Dot Product of Vectors
Dot Product of Vectors
Dot Product of Vectors
In linear algebra and computational geometry, the dot product is a fundamental operation. Given two \(n\)-dimensional vectors \(\mathbf{a} = (a_1,a_2,\cdots,a_n)\) and \(\mathbf{b} = (b_1,b_2,\cdots,b_n)\), compute their dot product defined as:
\[ \mathbf{a} \cdot \mathbf{b} = a_1b_1 + a_2b_2 + \cdots + a_nb_n \]
inputFormat
The input starts with an integer n representing the dimension of the vectors. The next line contains n space-separated integers denoting the elements of vector a. The following line contains n space-separated integers denoting the elements of vector b.
outputFormat
Output a single integer which is the dot product of vectors a and b.
sample
3
1 2 3
4 5 6
32