hdoj 1071 The area
The area
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8388 Accepted Submission(s):
5888
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.
#include<stdio.h>
#include<math.h>
int main()
{
int N;
double a,b,c,d,k,x1,y1,x2,y2,x3,y3,s;
scanf("%d",&N);
while(N--)
{
s=0;
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
a=((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3))/((x1*x1-x3*x3)*(x1-x2)-(x1*x1-x2*x2)*(x1-x3));
d=((y1-y3)-a*(x1*x1-x3*x3))/(x1-x3);
c=y1-a*x1*x1-d*x1;
k=(y2-y3)/(x2-x3);
b=y3-k*x3;
s=((a*x3*x3*x3)/3+((d-k)*x3*x3)/2+(c-b)*x3)-((a*x2*x2*x2)/3+((d-k)*x2*x2)/2+(c-b)*x2);
printf("%.2lf\n",s);
}
return 0;
}
hdoj 1071 The area的更多相关文章
- HDU 1071 The area(求三个点确定的抛物线的面积,其中一个点是顶点)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1071 The area Time Limit: 2000/1000 MS (Java/Others) ...
- 【HDOJ】1071 The area
数学题,先求抛物线和直线的系数,再利用积分公式求面积. #include <stdio.h> #include <math.h> int main() { double x1, ...
- HDU - 1071 - The area - 高斯约旦消元法 - 自适应辛普森法积分
http://acm.hdu.edu.cn/showproblem.php?pid=1071 解一个给定三个点的坐标二次函数某区域的积分值. 设出方程之后高斯消元得到二次函数.然后再消元得到直线. 两 ...
- HDU 1071 - The area
求曲线和直线围成的面积 求表达式,求积分 #include <iostream> using namespace std; ],y[]; int t; double k,m;//fx1: ...
- HDU ACM 1071 The area 定积分计算
分析: 1.求抛物线方程F(x)=a*x^2+b*x+c: 2.求直线方程f(x)=k*x+b. 3.利用定积分计算F(x)-f(x)在x2到x3之间的面积. #include<iostream ...
- HDU 1071 The area (数学定积分)
题意:求阴影部分面积. 析:没什么可说的,就是一个普通的定积分. 代码如下: #include <cstdio> #include <iostream> using names ...
- HDU 1071 The area ——微积分
[题目分析] 求二次函数和一次函数围成的面积. 先解方程求出一次函数和二次函数. 然后积分. 现在还是不会积分. [代码] #include <cstdio> #include <c ...
- hdu 1071 The area【定积分】
用顶点式\( a(x-h)^2+k=y \)解方程,转化为\(ax^2+bx+c=y \)的形式,然后对二次函数求定积分\( \frac{ax^3}{3}+\frac{bx^2}{2}+cx+C \) ...
- Simpson公式的应用(HDU 1724/ HDU 1071)
辛普森积分法 - 维基百科,自由的百科全书 Simpson's rule - Wikipedia, the free encyclopedia 利用这个公式,用二分的方法来计算积分. 1071 ( T ...
随机推荐
- Android 获取JSP或ASP的sessionId(Cookie)
如果使用的是httpClient: try { HttpResponse response = HttpUtil.httpClient.execute(new HttpGet(url)); Heade ...
- ids & hdmi 原理
http://www.taiwanwebinar.com/zh_TW/STATIC/SITE/dwc_hdmi_tx.pdf http://blog.csdn.net/g_salamander/art ...
- JVM内存状况查看方法和分析工具
Java本身提供了多种丰富的方法和工具来帮助开发人员查看和分析GC及JVM内存的状况,同时开源界和商业界也有一些工具可用于查看.分析GC及JVM内存的状况.通过这些分析,可以排查程序中内存泄露的问题及 ...
- js常用函数(不断添加中。。。)
/************************************************* Function: getColor Description: 根据输入的数字返回一个颜色值 In ...
- Oracle程序包
程序包由两部分构成:规范(specification)和主体(body). 创建表 create table PEOPLE ( ID NUMBER primary key not null, NAME ...
- Struts中的 saveToken的方法
Struts中的 saveToken的方法 saveToken防止2次提交的问题 struts有自带的Token(令牌)的机制来解决重复提交(包括后退,刷新等).举例: 假设:假设有一个新增用 ...
- 4418SPI2对应管脚位置
MCU_SPICLK2 MCU_SPITXD2 MCU_SPIFRM2 MCU_SPIRXD2
- NFC(12)使用Android Beam技术传输文本数据及它是什么
Android Beam技术是什么 Android Beam的基本理念就是两部(只能是1对1,不可像蓝牙那样1对多)NFC设备靠近时(一般是背靠背),通过触摸一部NFC设备的屏幕,将数据推向另外一部N ...
- eclipse不自动弹出提示(Alt+/ 快捷键失效)
转自:http://www.cnblogs.com/shaweng/archive/2013/09/26/3340016.html 主要有一下几种方法: 1.次方法用于没有一点提示的情况:依次打 ...
- Android 内存管理分析(四)
尊重原创作者,转载请注明出处: http://blog.csdn.net/gemmem/article/details/8920039 最近在网上看了不少Android内存管理方面的博文,但是文章大多 ...