# The area 积分积分

The area

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Submit Status

Description

Ignatius bought a land last week, but he didn‘t know the area of the land because the land is enclosed by a parabola and a straight line. The picture below shows the area. Now given all the intersectant points shows in the picture, can you tell Ignatius the area of the land?

Note: The point P1 in the picture is the vertex of the parabola.

Input

The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains three intersectant points which shows in the picture, they are given in the order of P1, P2, P3. Each point is described by two floating-point numbers X and Y(0.0<=X,Y<=1000.0).

Output

For each test case, you should output the area of the land, the result should be rounded to 2 decimal places.

Sample Input

2

5.000000 5.000000

0.000000 0.000000

10.000000 0.000000

10.000000 10.000000

1.000000 1.000000

14.000000 8.222222

Sample Output

33.33

40.69

``` 1 #include <iostream>
2 #include <math.h>
3 #include <stdio.h>
4 #include <string.h>
5 using namespace std;
6 struct point
7 {
8     double x,y;
9 } p1,p2,p3;
10 double a,b,c,a1,b1;
11 double F(double x)
12 {
13     return fabs(a*(x-b)*(x-b)+c-a1*x-b1);
14 }
15 void init()
16 {
17     b = p1.x;
18     c = p1.y;
19     a = (p2.y - c) / (p2.x - b) / (p2.x - b);
20     a1 = (p3.y - p2.y) / (p3.x - p2.x);
21     b1 = p2.y - a1 * p2.x;
22     //cout<<a<<"   "<<b<<"    "<<c<<" "<<a1<<" "<<b1<<" "<<endl;
23 }
24 //三点辛普森公式
25 double simpson(double width,double fa,double fb,double fc)
26 {
27     return (fb+fa+4*fc)*width/6;
28 }
29
30 //自适应simpson公式递归过程
31 double asr(double a,double b,double eps,double A)
32 {
33     double c=(a+b)/2;
34     double fa,fb,fc,L,R;
35     fa=F(a);
36     fb=F(b);
37     fc=F(c);
38     L=simpson(c-a,fa,fc,F((c+a)/2));
39     R=simpson(b-c,fc,fb,F((b+c)/2));
40     if(fabs(L+R-A)<=15*eps) return L+R+(L+R-A)/15;
41     return asr(a,c,eps/2,L)+asr(c,b,eps/2,R);
42 }
43 double asr1(double a,double b,double eps)
44 {
45     return asr(a,b,eps,simpson(b-a,F(a),F(b),F((b+a)/2)));
46 }
47 int main()
48 {
49     int t;
50     scanf("%d",&t);
51     while(t--)
52     {
53         scanf("%lf%lf",&p1.x,&p1.y);
54         scanf("%lf%lf",&p2.x,&p2.y);
55         scanf("%lf%lf",&p3.x,&p3.y);
56         init();
57         printf("%.2lf\n",asr1(p2.x,p3.x,0.0000001));
58     }
59 }```

The area 积分积分,布布扣,bubuko.com

## HDU1071 The area 【积分】

The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7476    Accepted Submission(s): 5222 Problem Description Ignatius bought a land last week, but he didn't know the area of the land becau

## [ACM] sdut 2877 angry_birds_again_and_again (简单数学积分）

angry_birds_again_and_again Time Limit: 2000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 The problems called "Angry Birds" and "Angry Birds Again and Again" has been solved by many teams in the series of contest in 2011 Multi-University

## Matlab基础学习------------------函数的极值、积分问题Matlab实现

<span style="font-size:18px;">% 函数的积分问题Matlab实现 %% 函数极值点 % 1.一元函数的极小值点 % 实例:求f(x)=x^3-x^2-x+1在区间[-2,2]的极小值点 [email protected](x)x.^3-x.^2-x+1 x=fminbnd(f,-2,2) %使用fminbnd()函数求解一元函数的极小值点,参数分别为f(x)和区间短点 y=f(x) %极小值点对应的函数值 %结果 % f = % @(x)x.^

## SPOJ CIRU The area of the union of circles ——Simpson积分

[题目分析] 圆的面积并. 直接Simpson积分,(但是有计算几何的解法,留着flag). simpson积分,如果圆出现了不连续的情况,是很容易出事情的.(脑补一下) 但是没有什么办法,本来就是一种取巧的做法,还能指望这暴力积分做什么. [代码] #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <map> #include &l

## 数据挖掘中所需的概率论与数理统计知识

http://blog.csdn.net/v_july_v/article/details/8308762 数据挖掘中所需的概率论与数理统计知识 (关键词:微积分.概率分布.期望.方差.协方差.数理统计简史.大数定律.中心极限定理.正态分布) 导言:本文从微积分相关概念,梳理到概率论与数理统计中的相关知识,但本文之压轴戏在本文第4节(彻底颠覆以前读书时大学课本灌输给你的观念,一探正态分布之神秘芳踪,知晓其前后发明历史由来),相信,每一个学过概率论与数理统计的朋友都有必要了解数理统计学简史,因为,