2
3994.707 9251.677 4152.916 7157.810 5156.835 2551.972
6903.233 3540.932 5171.382 3708.015 213.959 2519.852
98099
206144
在三角形 ABC 中,D E F 分别是三边的三等分点,P Q R 三点构成了一个三角形,求这个三角形的面积
int i,j,k;
int n,m,t;
struct Point
{
double x,y;
Point(double x=0,double y=0):x(x),y(y){}
};
typedef Point Vector;
Vector operator-(Vector a,Vector b){ return Vector(a.x-b.x,a.y-b.y); }
Vector operator+(Vector a,Vector b){ return Vector(a.x+b.x,a.y+b.y); }
Vector operator*(double k,Vector a){ return Vector(a.x*k,a.y*k); }
double Cross(Vector a,Vector b)
{
return a.x*b.y-a.y*b.x;
}
Point get_point(Point a,Vector v,Point b,Vector w)
{
Vector u=a-b;
double t=Cross(w,u)/Cross(v,w);
return a+t*v;
}
double area(Point a,Point b,Point c)
{
Vector u=b-a;
Vector v=c-a;
return fabs(Cross(u,v)/2);
}
int main()
{
//IOS;
rush(){
Point a,b,c;
sff(a.x,a.y); sff(b.x,b.y); sff(c.x,c.y);
Point d=b+1.0/3*(c-b);
Point e=c+1.0/3*(a-c);
Point f=a+1.0/3*(b-a);
Point p=get_point(a,d-a,b,e-b);
Point r=get_point(c,f-c,a,d-a);
Point q=get_point(b,e-b,c,f-c);
double ans=area(p,r,q);
pd(int(ans+0.5));
}
PAUSE;
return 0;
}