http://acm.hdu.edu.cn/showproblem.php?pid=1071
按要求求出面积即可
View Code
#include <stdio.h> int main() { int t; double x0,y0,x1,y1,x2,y2; double k,b; double a; double s; scanf("%d",&t); while(t--) { scanf("%lf%lf%lf%lf%lf%lf",&x0,&y0,&x1,&y1,&x2,&y2); k=(y2-y1)/(x2-x1); b=y1-k*x1; a=(y1-y0)/(x1-x0)/(x1-x0); s=(a*x2*x2*x2/3-a*x0*x2*x2+(a*x0*x0+y0)*x2-a*x1*x1*x1/3+a*x0*x1*x1-(a*x0*x0+y0)*x1-k*x2*x2/2-b*x2+k*x1*x1/2+b*x1); printf("%.2lf\n",s); } return 0; }