This problem do a little helpless, definite integral has forgotten almost ~ also hateful to search the parabola of analytic method ~ haha
But the result is wrong ... Wait until you have time to study this math problem--
Here is the Java implementation:
ImportJava.io.BufferedInputStream;ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {Scanner scan=NewScanner (NewBufferedinputstream (system.in)); intn =Scan.nextint (); while(N--! =0){ DoubleX1 =scan.nextdouble (); DoubleY1 =scan.nextdouble (); Doublex2 =scan.nextdouble (); Doubley2 =scan.nextdouble (); Doublex3 =scan.nextdouble (); DoubleY3 =scan.nextdouble (); DoubleA = ((y2-y1) * (X3-X2)/(X2-X1)-(Y3-y2))/((x2*x2-x1*x1) * (X3-X2)/(X2-X1)-(x3*x3-x2*x2)); DoubleB = ((y2-y1)-a* (X2*X2-X1*X1))/(x2-x1); Doublec = y1-a*x1*x1-b*X1; Doubles = (a/3*x3*x3*x3+b/2*x3*x3+c*x3)-(A/3*X2*X2*X2+B*X2*X2/2+C*X2)-(y3+y2) * (X3-X2)/2; System.out.printf ("%.2f", s); System.out.println (); } scan.close (); }}
hdoj-acm1071 (JAVA) Definite integral