class Solution {
public:
vector<int> multiply(const vector<int>& A) {
int n = A.size();
if (!n) return A; //判空
vector<int> B(n);
for (int i = 0, p = 1; i <n; i ++ ) //先让B[i]等于i左半边的乘积
{
B[i] = p;
p *= A[i];
}
for (int i = n - 1, p = 1; ~i; i -- ) //再用B[i]乘以i右半边的乘积
{
B[i] *= p;
p *= A[i];
}
return B;
}
};