51nod1265四點共面

原題鏈接

四點共面即以某點指向其它三點的向量的混合積爲0

代碼如下:

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#include <vector>
#define ll long long
using namespace std;

int main()
{
	int i, j, k, t, x, y, z, a[3][3];

	scanf( "%d", &t);
	while ( t--){
		scanf( "%d%d%d", &x, &y, &z);
		for ( i = 0; i < 3; i++){
			scanf( "%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
			a[i][0] -= x;
			a[i][1] -= y;
			a[i][2] -= z;
		}
		x = a[0][1] * a[1][2] - a[0][2] * a[1][1];
		y = a[0][2] * a[1][0] - a[0][0] * a[1][2];
		z = a[0][0] * a[1][1] - a[0][1] * a[1][0];
		x = x * a[2][0] + y * a[2][1] + z * a[2][2];
		if ( x)
		printf( "No\n");
		else
		printf( "Yes\n");
	}
	return 0;
}

基本算是放假了大笑,暑假好好搞搞各方面,各種算法、數學、專業知識,加油啦



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章