标签:
这道题做起来有点无奈,定积分已经忘得差不多了~还可恶的去搜索了抛物线的解析式的求法~哈哈
不过求出来的结果不对...等有时间再去研究这个数学问题吧 - -
以下是JAVA实现:
import java.io.BufferedInputStream; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in)); int n = scan.nextInt(); while(n--!=0){ double x1 = scan.nextDouble(); double y1 = scan.nextDouble(); double x2 = scan.nextDouble(); double y2 = scan.nextDouble(); double x3 = scan.nextDouble(); double y3 = scan.nextDouble(); double a = ((y2-y1)*(x3-x2)/(x2-x1)-(y3-y2))/((x2*x2-x1*x1)*(x3-x2)/(x2-x1)-(x3*x3-x2*x2)); double b = ((y2-y1)-a*(x2*x2-x1*x1))/(x2-x1); double c = y1-a*x1*x1-b*x1; double s = (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(); } }
标签:
原文地址:http://www.cnblogs.com/xiezie/p/5599094.html