11933 - Vector Dot   

Description

Implement a Vector class that support n-dimensional vector dot product.

Your task is to complete

  • const int operator[](int index) const;
  • int operator*(const Vector& a);

inside the Vector class;

Remember to #include "function.h"!

Input

First line of input is an integer m, where m is the number of testcases.There are m testcases following.

A testcases consists of three lines:

  • In the first line of each testcase, there are a string OP and an integer n, where OP is the operation and n is the vector size.
  • In the second line of each testcase, there are n integers, representing all the elements inside the first vector, A.
  • In the third line of each testcase, there are n integers, representing all the elements inside the second vector, B.

​It is guaranteed that:

  • ≤ nm ≤ 100
  • For all the elements x in vector A and B, |x| ≤ 100

Output

For each testcase, according to its operation, output the result of A*B. There is a space after every number.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11933.cpp

Partial Judge Header

11933.h

Tags




Discuss