记录编号 294327 评测结果 AAAAAAAAAA
题目名称 膜拜神犇 最终得分 100
用户昵称 GravatarAntiLeaf 是否通过 通过
代码语言 C++ 运行时间 0.458 s
提交时间 2016-08-11 21:26:51 内存使用 0.23 MiB
显示代码纯文本
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef struct Point{
	int x,y;
	Point(int x=0,int y=0):x(x),y(y){}
}Vector;
Vector FromTo(Point,Point);
int Dot(Vector,Vector);
int Cross(Vector,Vector);
Point a,b,c;
Vector A,B,C;
int T,x,y,z,ans=0;
int main(){
#define MINE
#ifdef MINE
	freopen("trioxorz.in","r",stdin);
	freopen("trioxorz.out","w",stdout);
#endif
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d%d%d%d",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y);
		A=FromTo(a,b);
		B=FromTo(b,c);
		C=FromTo(c,a);
		x=Cross(b,A);
		y=Cross(c,B);
		z=Cross(a,C);
		if((x<0&&y<0&&z<0)||(x>0&&y>0&&z>0))ans++;
	}
	printf("%d",ans);
	return 0;
}
Vector FromTo(Point a,Point b){
	return Vector(b.x-a.x,b.y-a.y);
}
int Dot(Vector a,Vector b){
	return a.x*b.x+a.y*b.y;
}
int Cross(Vector a,Vector b){
	return Dot(Vector(-a.y,a.x),b);
}