分析:
基本操作的训练
//这里写代码片
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#define LD double
using namespace std;
const LD eps=1e-8;
struct node{
LD x,y;
node (LD xx=0,LD yy=0)
{
x=xx;y=yy;
}
};
node operator + (const node &a,const node &b){return node(a.x+b.x,a.y+b.y);}
node operator - (const node &a,const node &b){return node(a.x-b.x,a.y-b.y);}
node operator * (const node &a,const double &b){return node(a.x*b,a.y*b);}
node operator / (const node &a,const double &b){return node(a.x/b,a.y/b);}
node operator < (const node &a,const node &b){return a.x<b.x||(a.x==b.x&&a.y<b.y);}
node operator == (const node &a,const node &b){return a.x==b.x&&a.y==b.y;}
int dcmp(LD x)
{
if (fabs(x)<eps) return 0;
else if (x>0) return 1;
else return -1;
}
LD Cross(const node &x,const node &y){return x.x*y.y-x.y*y.x;}
LD Dot(const node &x,const node &y){return x.x*y.x+x.y*y.y;}
node XiangJiao(node P,node v,node Q,node w)
{
node u=P-Q;
LD t=Cross(w,u)/Cross(v,w);
return P+v*t;
}
LD SS(node A,node B,node C)
{
LD ans=Cross(B-A,C-A);
return fabs(ans)/2;
}
int main()
{
node A,B,C,D,E,F,P,R,Q;
int T;
scanf("%d",&T);
while (T--)
{
scanf("%lf%lf",&A.x,&A.y);
scanf("%lf%lf",&B.x,&B.y);
scanf("%lf%lf",&C.x,&C.y);
D=B+(C-B)/3;
E=C+(A-C)/3;
F=A+(B-A)/3;
P=XiangJiao(B,E-B,A,D-A);
Q=XiangJiao(C,F-C,E,E-B);
R=XiangJiao(A,D-A,C,F-C);
LD ans=SS(P,Q,R);
printf("%d\n",(int)(ans+0.5));
}
return 0;
}