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. 在windows10上创建ASP.NET mvc5+Memcached服务

    感谢两位两位大佬: https://blog.csdn.net/l1028386804/article/details/61417166 https://www.cnblogs.com/running ...

  2. AEAI Portal 权限体系说明

    1.概述 在数通畅联的产品体系中,AEAI Portal毫无疑问的占据了很重要的地位,在这里我们将通过参考Portal样例,讲述一下AEAI Portal权限体系的控制方法.在Portal使用过程中, ...

  3. [模板]最小割树(Gomory-Hu Tree)(luogu4897)

    给定一个\(n\)个点\(m\)条边的无向连通图,多次询问两点之间的最小割 两点间的最小割是这样定义的:原图的每条边有一个割断它的代价,你需要用最小的代价使得这两个点不连通 Input 第一行两个数\ ...

  4. Postgres 的 deferrable

    仅 Postgres 支持 deferrable deferrable 即 推迟约束 一.定义字段时指定 定义:exam考试表里 subject_iddddd 字段关联了 subject 科目表的 i ...

  5. AutoCompleteTextView搭配Poi搜索实现多项选择

    项目需要 需要用到AutoCompleteTextView控件,在输入之后能在下方产生一个推荐结果的列表,就类似于金山词霸一类软件.输入一两个字符就能出来一系列类似的的单词, 这里做的例子是输入城市名 ...

  6. opencv2.4.13.7的resize函数使用(c++)

    先来看一下resize函数的原型,如下. C++: void resize(InputArray src, OutputArray dst, Size dsize, double fx=0, doub ...

  7. MetaMask安装使用指南

    1.MetaMask(轻钱包) MetaMask是一款在谷歌浏览器Chrome上使用的插件类型的以太坊钱包,该钱包不需要下载,只需要在谷歌浏览器或基于谷歌浏览器内核的其它浏览器(如:360极速浏览器- ...

  8. Java语言基础(方法与数组)_DAY05

    1:函数(掌握)   (1)定义在类中,有特定功能的一段小程序,可以独立运行.    (2)函数的格式:       修饰符 返回值类型 函数名(形参类型 形式参数1,形参类型 形式参数2...)   ...

  9. 使用代码查看Nutch爬取的网站后生成的SequenceFile信息

    必须针对data文件中的value类型来使用对应的类来查看(把这个data文件,放到了本地Windows的D盘根目录下). 代码: package cn.summerchill.nutch; impo ...

  10. freerdp服务器共享屏幕,skype lync终端显示黑屏的原因分析

    问题描述:freerdp支持远程桌面共享协议rdp,使用freerdp与skype终端进行远程桌面共享时.发送1080p 视频数据时 skype终端显示黑屏 经过分析,发现rdp协商参数大于一定值时, ...