The area (hdu1071)积分求面积
The area
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7066 Accepted Submission(s):
4959
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.
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).
land, the result should be rounded to 2 decimal places.
For float may be not accurate enough, please use double instead of float.
#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)积分求面积的更多相关文章
- HDU_1071——积分求面积,抛物线顶点公式
Problem Description Ignatius bought a land last week, but he didn't know the area of the land becaus ...
- poj 1265 Area (Pick定理+求面积)
链接:http://poj.org/problem?id=1265 Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...
- poj 1654 Area (多边形求面积)
链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...
- hdu1071(定积分求面积)
太弱了,写了一下午,高中基础太差的孩子伤不起... 记住抛物线是关于x轴对称的. 而且抛物线的方程可以是: y=k(x-h)+c //其中(h,c)为顶点坐标 The area Time Limit ...
- bzoj1502 simpson求面积
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1502 题解: simpson积分求面积,s = (f(a)+f(b)+4*f(c))/6*Δx ...
- poj 3348--Cows(凸包求面积)
链接:http://poj.org/problem?id=3348 Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: ...
- P - Atlantis - hdu1542(求面积)
题意:rt 求面积......不计算重复面积(废话..)hdu1255 的弱化版,应该先做这道题在做那道题的. ******************************************** ...
- 编写一个矩形类,私有数据成员为矩形的长( len)和宽(wid),wid设置为0,有参构造函数设置和的值,另外,类还包括矩形的周长、求面积、取矩形的长度、取矩形的长度、取矩形的宽度、修改矩形的长度和宽度为对应的形参值等公用方法。
class Rectangle { private double len, wid; public Rectangle()//求矩形周长 { len = 0; wid = 0; } public Re ...
- HDU - 1255 覆盖的面积 (线段树求面积交)
https://cn.vjudge.net/problem/HDU-1255 题意 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. 分析 求面积并的题:https://www.cnbl ...
随机推荐
- c#中的gcAllowVeryLargeObjects和OutOfMemoryException
什么是gcAllowVeryLargeObjects 在.net4.5中新增一个配置项 “gcAllowVeryLargeObjects” ,msdn解释如下: 在64位平台上,可以允许总共大于2千兆 ...
- Windows下安装配置爬虫工具Scrapy及爬虫环境
爬虫工具Scrapy在Mac和Linux环境下都相对好装,但是在Windows上总会碰到各种莫名其妙的问题.本文记录下Scrapy在Window上的安装过程. 本文是基于Python2.7及Windo ...
- HttpInvokerUtils
package com.sprucetec.tms.utils; import org.slf4j.Logger;import org.slf4j.LoggerFactory; import java ...
- @JsonInclude、@JsonFormat、@DateTimeFormat注解的使用
@JsonInclude(value=Include.NON_NULL) :用在实体类的方法类的头上 作用是实体类的参数查询到的为null的不显示 @DateTimeFormat:用于接收 前端传的 ...
- 【xsy2425】容器 dp
题目大意:有$n$个人,区间大小为$m$,每个人必须覆盖一段区间$[l_i,r_i]$,问你存在多少种不同的覆盖方案,使得区间上每个位置被覆盖的次数不超过$t$. 两种方案被定义为不同当且仅当存在第i ...
- Node.js中的模块接口module.exports浅析
在写node.js代码时,我们经常需要自己写模块(module).同时还需要在模块最后写好模块接口,声明这个模块对外暴露什么内容.实际上,node.js的模块接口有多种不同写法.这里作者对此做了个简单 ...
- Win7上Spark WordCount运行过程及异常
WordCount.Scala代码如下: package com.husor.Spark /** * Created by huxiu on 2014/11/26. */ import org.apa ...
- 记一次TCP重发接口调用的问题
问题描述:基于微软RDP协议,使用开源rdp库与微软skpye软件进行基于tcp的p2p通讯,由于rdp协议传输原始图片数据较大,调用公司内部ice p2p通讯接口处会导致失败. 错误思路:一开始是怀 ...
- Zookeeper--0200--安装与集群搭建、常用命令、客户端工具
看这里,http://www.cnblogs.com/lihaoyang/p/8358153.html 1,先使用可视化客户端软件 ZooInspector 连接上集群中的一个节点,看下zk的结构: ...
- JavaScript -- Form
-----048-Form.html----- <!DOCTYPE html> <html> <head> <meta http-equiv="co ...