class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
* 计算出这两个向量叉乘的结果
* @param vector1 int整型vector
* @param vector2 int整型vector
* @return int整型vector
*/
vector<int> crossTimes(vector<int>& v1, vector<int>& v2) {
vector<int>v3;
int x1,x2,x3;
x1=v1[1]*v2[2]-v1[2]*v2[1];
v3.push_back(x1);
x2=v1[0]*v2[2]-v1[2]*v2[0];
v3.push_back(-x2);
x3=v1[0]*v2[1]-v1[1]*v2[0];
v3.push_back(x3);
return v3;
}
};
知道叉乘是啥就行

京公网安备 11010502036488号