传送门:

http://acm.hdu.edu.cn/showproblem.php?pid=1071

The area

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

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
 
题目意思:
告诉你三个点,有一个点抛物线顶点,问你这三个点在抛物线中确定的面积
 
分析:
设抛物线y=a(x-b)^2+c   p1总是抛物线的顶点
    所以根据p1和另外随便一个点我们可以确定抛物线方程中的所有参数
    直线方程y=kx+d;
    抛物线方程减去直线方程的积分就是二者形成的面积
    面积就是a(x-b)^2+c-kx-d的积分
 
code:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
double a,b,c,k,d;
double f(double x)//积分
{
return a*x*x*x/-(*a*b+k)*x*x/+(a*b*b+c-d)*x;
}
int main()
{
/*
设抛物线y=a(x-b)^2+c p1总是抛物线的顶点
直线方程y=kx+d;
面积就是a(x-b)^2+c-kx-d的积分
*/
double x1,y1,x2,y2,x3,y3;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
c=y1;
b=x1;
a=(y2-c)/((x2-b)*(x2-b));
k=(y3-y2)/((x3-x2));
d=y2-k*x2;
printf("%0.2lf\n",f(x3)-f(x2));
}
return ;
}
 

HDU 1071 The area(求三个点确定的抛物线的面积,其中一个点是顶点)的更多相关文章

  1. Agent J(求三个圆围成的区域面积)

    A - A Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status P ...

  2. HDU - 1071 - The area - 高斯约旦消元法 - 自适应辛普森法积分

    http://acm.hdu.edu.cn/showproblem.php?pid=1071 解一个给定三个点的坐标二次函数某区域的积分值. 设出方程之后高斯消元得到二次函数.然后再消元得到直线. 两 ...

  3. HDU 1071 - The area

    求曲线和直线围成的面积 求表达式,求积分 #include <iostream> using namespace std; ],y[]; int t; double k,m;//fx1: ...

  4. HDU 1071 The area (数学定积分)

    题意:求阴影部分面积. 析:没什么可说的,就是一个普通的定积分. 代码如下: #include <cstdio> #include <iostream> using names ...

  5. HDU 1071 The area ——微积分

    [题目分析] 求二次函数和一次函数围成的面积. 先解方程求出一次函数和二次函数. 然后积分. 现在还是不会积分. [代码] #include <cstdio> #include <c ...

  6. 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 \) ...

  7. HDU 6625 three arrays 求两个序列异或最小值的排列(一个可以推广的正解

    目录 题意: 解析 原题描述 字典树动态求Mex @(hdu 6625求两个序列异或最小值的排列) 题意: \(T(100)\)组,每组两个长度为\(n(100000)\)的排列,你可以将\(a[]\ ...

  8. 25.按要求编写一个Java应用程序: (1)编写一个矩形类Rect,包含: 两个属性:矩形的宽width;矩形的高height。 两个构造方法: 1.一个带有两个参数的构造方法,用于将width和height属性初化; 2.一个不带参数的构造方法,将矩形初始化为宽和高都为10。 两个方法: 求矩形面积的方法area() 求矩形周长的方法perimeter() (2)通过继承Rect类编写一个具有

    package zhongqiuzuoye; //自己写的方法 public class Rect { public double width; public double height; Rect( ...

  9. Hdu 1358 Period (KMP 求最小循环节)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1358 题目描述: 给出一个字符串S,输出S的前缀能表达成Ak的所有情况,每种情况输出前缀的结束位置和 ...

随机推荐

  1. 【Unity&独立游戏&音效】免费音效网站总览

    转载 http://blog.csdn.net/BuladeMian/article/details/70240868

  2. H5禁止页面滑动/滚动

    禁止页面滚动--完美解决方案,滚动条显示与否,手持设备兼容与否 禁止页面滚动 有三种方法 1,依靠css 将页面 document.documentElement.style.overflow='hi ...

  3. Javascript “等于”

    JavaScript支持“=”.“==”和“===”运算符. 我们应当理解这些(赋值.相等.恒等)运算符之间的区别,并在编码过程中小心使用. == equality 等同,用于一般比较,在比较的时候可 ...

  4. django基本入门

    1.创建应用 2.设计模型 3.语言时区等设置 4. Templates 1.创建应用[MVT] 一个项目可以有多个应用[模块]: 这里已经创建了项目:test1 python manager.py ...

  5. 自己用到的vim常用命令

    一.前言 这里整理的是我在实习期间用到的常用vim命令,特记录如下,以免忘记. 二.vim常用命令 1.vim中的光标移动 shift+6(^):跳到行首(第一个非空格字符)(注:在shell跳到行首 ...

  6. IO流之递归

    递归: 递归,指在当前方法内调用自己的这种现象 public void method(){ System.out.println(“递归的演示”); //在当前方法内调用自己 method(); } ...

  7. 前端(三大框架、Bootstrap,jQuery,自整理)

    前端,HTML(超文本标记语言),CSS(层叠样式表)和JavaScript(脚本语言) HTML,通常说的h5,其实按标准来说,HTML4的后续版本不带编号了,并保证向前的兼容性 CSS的版本3,增 ...

  8. HTML表单特别效果—音量调节,购物数量

    <form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0<input type="ra ...

  9. CSS中font-family:中文字体对应的英文名称

    中文字体 对应英文字体 宋体 SimSun 黑体 SimHei 微软雅黑 Microsoft YaHei 微软正黑体 Microsoft JhengHei 新宋体 NSimSun 新细明体 PMing ...

  10. 【Linux】文本编辑器Vim常用操作入门

    Linux常用文本编辑器:Vi & Eamcs Vim -- Vi的升级版本 Vim 一.3种工作模式 命令行模式 (Command Mode) 插入模式 (Insert Mode) -- 键 ...