|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
Description
If you are not familiar with partial judge , please check this handout
Implement a Vector class that support n-dimensional vector add, subtract and dot product.
Your task is to complete
- const int size() const;
- Vector operator+(const Vector& a);
- Vector operator-(const Vector& a);
- const int operator[](int index) const;
- int operator*(const Vector& a);
inside the Vector class, and std::ostream& operator<<(std::ostream& os, const Vector& v);
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:
- 1 ≤ m ≤ 100, 1 ≤ n ≤ 300
- 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, A-B or A*B. There is a space after every number.
Partial Judge Code
11915.cpp
Partial Judge Header
11915.h
Tags