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

记住抛物线是关于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. 工作总结 @Html 辅助方法 为 生成的 标签设置元素属性 htmlAttributes 一个对象,其中包含要为该元素设置的 HTML 特性。

    @Html.RadioButtonFor(m => m.IsJianChe, true, new { @style = "width: 18px; height: 18px;" ...

  2. OCR 识别原理

    https://mp.weixin.qq.com/s?__biz=MzA3MDExNzcyNA==&mid=402907292&idx=1&sn=889c4abcf576e24 ...

  3. Json序列化之.NET开源类库Newtonsoft.Json

    上代码: using System; using System.Collections; using System.Collections.Generic; using System.IO; usin ...

  4. unity, inspector listview

    inspector中实现列表框: public override void OnInspectorGUI(){ bool isDoubleClick=false;        Event e = E ...

  5. CentOS 删除桌面环境

    帮客户买了一个vps, 结果里面装了一堆没用的软件,所以全部删掉 CentOS 桌面安装大多都是 以软件包的 形式安装 所以 最好是设置好 国内的yum 源, 然后执行: >yum groupl ...

  6. ubuntu apt-get方式安装与卸载

    在ubuntu终端中安装软件: 安装软件 apt-get install softname1 softname2 softname3……卸载软件 apt-get remove softname1 so ...

  7. 04、Quick Start for Windows

    创建一个新工程 1.在 VS 上,选择 File > New > Project.. 2.在新工程窗口,选择  Visual C# > Windows Store > Blan ...

  8. 深入浅出Spring(一)Spring概述

    现在很多的企业级项目中基本上都会用到了Spring框架,那么为什么会出现Spring,Spring是什么?这次的博文我主要为大家简单介绍一下Spring. Java EE优缺点 我们都知道在2003年 ...

  9. ural1517后缀数组

    题意:求两串字符(0————255)的最长公共字串 思路:先将两个字符链接起来,中间用一个不曾出现过的字符,然后直接求出height数组,然后根据它的特性,求出最长的公共字串,当然这个最长公共字串的坐 ...

  10. C语言 · 数组查找及替换

    算法训练 数组查找及替换   时间限制:1.0s   内存限制:512.0MB      问题描述 给定某整数数组和某一整数b.要求删除数组中可以被b整除的所有元素,同时将该数组各元素按从小到大排序. ...