The area

//抛物线的顶点公式y=a(x-x1)^2+y1
#include <iostream> struct node { double x; double y; }; int main() { node p1,p2,p3; int n; scanf("%d",&n); while(n--) { scanf("%lf%lf%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y,&p3.x,&p3.y); // y=a*(x-h)^2+k double h=p1.x,k=p1.y; double a=(p2.y-k)/((p2.x-h)*(p2.x-h)); double s=(a*(p3.x-h)*(p3.x-h)*(p3.x-h)/3-a*(p2.x-h)*(p2.x-h)*(p2.x-h)/3+k*(p3.x-p2.x)); s-=((p2.y+p3.y)*(p3.x-p2.x))/2; printf("%.2lf\n",s); } return 0; }

 

posted @ 2013-09-19 15:26  Destino74  阅读(90)  评论(0编辑  收藏  举报