题意就不说了。。看图就懂。。。
数学略挫。只能证明出一半。。。其实这种题取特殊情况,用正三角形来证明就课得到结论。
要求的面积是告诉的三角形面积的七分之一。
知道这个题目就变的简单多了。
看代码
#include<cstdio> #include<iostream> #include<cmath> using namespace std; typedef struct /*点的定义*/ { double x,y; }Point; double Cross(Point a,Point b) /*叉乘*/ { return a.x*b.y - a.y*b.x; } Point operator - (Point a,Point b) /*定义操作符*/ { Point c; c.x = a.x - b.x; c.y = a.y - b.y; return c; } double Area2(Point a,Point b,Point c) /*三点求三角形面积*/ { return Cross(b-a,c-a); } int main() { #ifdef LOCAL freopen("in.txt","r",stdin); #endif // LOCAL Point a,b,c; int ncase; cin>>ncase; while(ncase--) { cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y; double ans = Area2(a,b,c)/14; printf("%.0lf\n",ans); } return 0; }