The area

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7066 Accepted Submission(s):
4959

Problem 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

Hint

For float may be not accurate enough, please use double instead of float.

 
 
 
一道高数题。
 
回顾一下微积分的知道,曲面的微积分。两个方程相减,对x或者y积分,就是面积。
然后具体的公式详见代码把,
 
 
#include<stdio.h>
//#include<math.h>与y1方法重载了、
double x1,y1,x2,y2,x3,y3;
double area;
double l,h,a,k,b; //曲线的方程可用顶点式 y = a(x-h)^2+l, (h,l) 为顶点坐标)
//直线方程 y = kx+b; //图形一定,只是点的位置不定。所以对x积分
double f(double x)
{
return (a*x*x*x/)-(a*h+k/)*x*x+(a*h*h+l-b)*x;//积分,化简
}
int main()
{ int T;
scanf("%d",&T);
while(T--)
{
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
h=x1;
l=y1;
a=(y2-y1)/((x2-h)*(x2-h));
k=(y3-y2)/(x3-x2);
b=y2-k*x2;
printf("%.2lf\n",f(x3)-f(x2));
}
return ;
}

The area (hdu1071)积分求面积的更多相关文章

  1. HDU_1071——积分求面积,抛物线顶点公式

    Problem Description Ignatius bought a land last week, but he didn't know the area of the land becaus ...

  2. poj 1265 Area (Pick定理+求面积)

    链接:http://poj.org/problem?id=1265 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:  ...

  3. poj 1654 Area (多边形求面积)

    链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:  ...

  4. hdu1071(定积分求面积)

    太弱了,写了一下午,高中基础太差的孩子伤不起... 记住抛物线是关于x轴对称的. 而且抛物线的方程可以是: y=k(x-h)+c  //其中(h,c)为顶点坐标 The area Time Limit ...

  5. bzoj1502 simpson求面积

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1502 题解: simpson积分求面积,s = (f(a)+f(b)+4*f(c))/6*Δx ...

  6. poj 3348--Cows(凸包求面积)

    链接:http://poj.org/problem?id=3348 Cows Time Limit: 2000MS   Memory Limit: 65536K Total Submissions:  ...

  7. P - Atlantis - hdu1542(求面积)

    题意:rt 求面积......不计算重复面积(废话..)hdu1255 的弱化版,应该先做这道题在做那道题的. ******************************************** ...

  8. 编写一个矩形类,私有数据成员为矩形的长( len)和宽(wid),wid设置为0,有参构造函数设置和的值,另外,类还包括矩形的周长、求面积、取矩形的长度、取矩形的长度、取矩形的宽度、修改矩形的长度和宽度为对应的形参值等公用方法。

    class Rectangle { private double len, wid; public Rectangle()//求矩形周长 { len = 0; wid = 0; } public Re ...

  9. HDU - 1255 覆盖的面积 (线段树求面积交)

    https://cn.vjudge.net/problem/HDU-1255 题意 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. 分析 求面积并的题:https://www.cnbl ...

随机推荐

  1. Weekly Contest 133

    1030. Matrix Cells in Distance Order We are given a matrix with R rows and C columns has cells with ...

  2. Linux系统文件权限管理(6)

    Linux操作系统是多任务(Multi-tasks)多用户(Multi-users)分时操作系统,linux操作系统的用户就是让我们登录到linux的权限,每当我们使用用户名登录操作系统时,linux ...

  3. 定位 和 z-index

    三.定位 定位有三种:(1) 相对定位.(2) 绝对定位.(3) 固定定位 1.相对定位(相对于自己原来的位置定位) 现象和使用: a.如果对当前元素仅仅设置了相对定位,那么与标准流的盒子没什么区别: ...

  4. Spring Boot中使用Flyway来管理数据库版本

    flyway是一个开源的数据库迁移工具.类似于数据库的版本控制工具.flyway的数据库修改文件默认放在resource下的db.migration文件夹中,以V{version_number}__{ ...

  5. Spring Boot中使用@Scheduled创建定时任务

    我们在编写Spring Boot应用中经常会遇到这样的场景,比如:我需要定时地发送一些短信.邮件之类的操作,也可能会定时地检查和监控一些标志.参数等. 创建定时任务 在Spring Boot中编写定时 ...

  6. Windows Service 项目中 Entity Framework 无法加载的问题

    Windows Service 项目引用了别的类库项目,别的项目用到了 Entity Framework(通过Nuget引入),但是我的 Windows Service 无法开启,于是我修改了 App ...

  7. 基于鸢尾花数据的PCA降维处理

  8. DockerFile(保你会版本)(七)

    一.什么是dockerfile Dockerfile是一个文本格式的配置文件,用户可以使用Dockerfile自定义快速创建属于自己的镜像,Dockerfile是通过很多的参数指令编写的文件,通过do ...

  9. editplus来编写html

    本来写这篇文章,我可以有很多废话,但是很多都过去了,言而总之下:我暂且给这个方法起个名字,叫做“为之法”,因为有了这篇文章,很多人的想法会豁然开朗,那样有了个名字交流传阅起来就方便多了. 本方法依托于 ...

  10. Dev Label显示不同颜色字体

    labelControl1.Text = "<size=14>Size = 14<br>" + "<b>Bold</b> ...