太弱了,写了一下午,高中基础太差的孩子伤不起。。。

记住抛物线是关于x轴对称的。

而且抛物线的方程可以是: y=k(x-h)+c  //其中(h,c)为顶点坐标

The area

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

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.

 
Author
Ignatius.L
 
#include <stdio.h>
#include <iostream>
using namespace std;
#define INF 0x3fffffff double x1,y1;
double x2,y2;
double x3,y3; int main()
{
//freopen("//home//chen//Desktop//ACM//in.text","r",stdin);
//freopen("//home//chen//Desktop//ACM//out.text","w",stdout);
int T;
scanf("%d",&T); while(T--)
{
scanf("%lf%lf",&x1,&y1);
scanf("%lf%lf",&x2,&y2);
scanf("%lf%lf",&x3,&y3);
double a,b,c,k,d;
b=x1;
c=y1;
a=(y2-c)/( (x2-b)*(x2-b) );
k=(y3-y2)/(x3-x2);
d=y3-x3*k;
double ans=(a*(x3-b)*(x3-b)*(x3-b)/)+c*x3-(k*x3*x3)/-d*x3-( ( a*(x2-b)*(x2-b)*(x2-b))/+c*x2-(k*x2*x2)/-d*x2);
if(ans<) ans*=-;
printf("%.2lf\n",ans);
}
return ;
}

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

  1. C# 定积分求周长&面积原理 代码实现

    前言: 前些日子,因为工作原因,接触到了求解曲线周长,真的是搞了很久,学生时代真的很简单,但是如今的我来说,忘记了....很多人跟我应该一样. 所以来巩固加强一下记忆.一开始的时候,求周长嘛,找公式呗 ...

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

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

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

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

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

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

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

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

  6. 覆盖的面积 HDU - 1255(扫描线求面积交)

    题意: 就是扫描线求面积交 解析: 参考求面积并.... 就是把down的判断条件改了一下..由w > 0 改为 w > 1 同时要讨论一下 == 1 时  的情况, 所以就要用到一个临时 ...

  7. hdu1542 Atlantis 线段树--扫描线求面积并

    There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some ...

  8. 两条线段求交点+叉积求面积 poj 1408

    题目链接:https://vjudge.net/problem/POJ-1408 题目是叫我们求出所有四边形里最大的那个的面积. 思路:因为这里只给了我们正方形四条边上的点,所以我们要先计算横竖线段两 ...

  9. 牛客训练二:处女座的签到题(STL+精度+三角形求面积公式)

    题目链接:传送门 知识点: (1)三个点,三角形求面积公式 (2)精度问题: double 15-16位(参考文章) float 6-7位 long long 约20位 int 约10位 unsign ...

随机推荐

  1. C++:模板友元

    模板友元函数在类内声明类外定义时都必须加模板前缀,另外模板要写在一个文件内 // generates undefined error for the operator<< function ...

  2. 【Arduino】超声波模块(HC-SR04)

    还好,这个模块有现成的库能够用: https://github.com/bosgood/arduino-playground/tree/master/lib/HCSR04Ultrasonic 下面仅仅 ...

  3. 实现WinForm窗体的美化(借助第三方控件)

    在winform项目中,其实皮肤就是一个第三方的控件,名字是IrisSkin4.dll只要添加到你的工具箱里就可以和其它控件一样使用了 一.添加控件IrisSkin4.dll.方法: 先把IrisSk ...

  4. XMLDocument转为String 摘录

    public static string FormatXmlString(string xmlString) { XmlDocument document = new XmlDocument(); d ...

  5. CentOS 安装 升级Firefox

    把旧版本的firefox卸掉: # yum erase firefox 然后安装新版本: # yum firefox

  6. atitit.html5 vs 原生 app的区别与选择

    atitit.html5  vs 原生 app的区别与选择 1. html5的优点 1 1.1. 最大优势::在跨平台(ios苹果,android安卓等) 1 1.2. 开放性 1 1.3. 快速的更 ...

  7. atitit.attilax.com产品 软件项目通用框架类库总结

    atitit.attilax.com产品页面 1. 微信公众号后台服务系统 1 2. 视频图文发布与点播系统 1 3. 图片验证码自动识别 2 4. 手机短信验证码自动识别 2 5. 爬虫,数据采集, ...

  8. python内置函数之vars()

    vars([object]) 返回__dict__属性的值.当不传入参数时,和locals()等效.当函数接收一个参数时,参数可以是模块.类.类实例,或者定义了__dict__属性的对象. >& ...

  9. Django rest_framework 认证源码流程

    一.请求到来后,都要先执行dispatch方法 dispatch根据请求方式的不同触发get/post/put/delete等方法 注意,APIView中的dispatch方法有很多的功能 def d ...

  10. 绕过IE10直接安装VS2013

    参考资料:http://blog.163.com/qimo601%40126/blog/static/1582209320143354446462/ 这SB设定我就懒得说了,安个IE10要安装N多WI ...