The area

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

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.

 
 
 
一道高数题。
 
回顾一下微积分的知道,曲面的微积分。两个方程相减,对x或者y积分,就是面积。
然后具体的公式详见代码把,
 
 
#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)积分求面积的更多相关文章

  1. HDU_1071——积分求面积,抛物线顶点公式

    Problem Description Ignatius bought a land last week, but he didn't know the area of the land becaus ...

  2. poj 1265 Area (Pick定理+求面积)

    链接:http://poj.org/problem?id=1265 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:  ...

  3. poj 1654 Area (多边形求面积)

    链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:  ...

  4. hdu1071(定积分求面积)

    太弱了,写了一下午,高中基础太差的孩子伤不起... 记住抛物线是关于x轴对称的. 而且抛物线的方程可以是: y=k(x-h)+c  //其中(h,c)为顶点坐标 The area Time Limit ...

  5. bzoj1502 simpson求面积

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1502 题解: simpson积分求面积,s = (f(a)+f(b)+4*f(c))/6*Δx ...

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

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

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

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

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

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

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

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

随机推荐

  1. 【Atcoder】 AGC032赛后总结

    比赛前 emmm,今天是场AGC,想起上次我的惨痛经历(B都不会),这次估计要凉,可能A都不会Flag1 比赛中 看场看了波\(A\),咦,这不是很呆的题目吗?倒着扫一遍就好了. 然后切了就开始看B, ...

  2. Mongodb--基础(连接,增删改查,数据类型)

    mongodb 日常启动命令 mongod --dbpath D:\data\db 一.启动,连接 mongodb是一个非关系型数据库 1. 启动MongoDB服务: 安装时我并没有将mongodb服 ...

  3. CSV Data Set Config设置

    Jmeter参数化常用的两种方法: 1.使用函数助手 2.CSV Data Set Config 本章主要讲解CSV Data Set Config设置 1.Filename:文件名,指保存信息的文件 ...

  4. JAVA常见安全问题复现

    地址来源于乌云知识库,作者z_zz_zzz 0x01 任意文件下载 web.xml的配置: <servlet> <description></description> ...

  5. 人工智能-机器学习之numpy方法

    机器学习 最重要的东西就是算法   这里面的水很深  所以呢我就简单的整理了一下 基础的操作     #导入numpy库 as别名 为了怕重名 import numpy as np # 打印版本号 p ...

  6. 将celery定时任务设置为根据本地时区触发

    默认celery的时区为UTC,如果要在django项目中将celery定时任务配置为根据本地时区触发,则需要修改 在setttings.py 添加以下任意一行: # celery 相关配置 CELE ...

  7. java 简单认识移位运算符和位运算符

    移位运算符和位运算符本质上都是操作二进制位,因为计算机存储的是二进制数据,运算效率相对较高. 移位运算符:把整数的二进制位进行左移或右移 .左移一位,相当于这个数乘以2, 右移一位,相当于这个数除以2 ...

  8. 副本集mongodb 无缘无故 cpu异常

    mondb 服务器故障 主从复制集 主:   192.168.1.106从:   192.168.1.100仲裁:192.168.1.102 os版本:CentOS Linux release 7.3 ...

  9. QQ gtk,bkn算法

    public long GetGTK(string sKey) { ; , len = sKey.Length; i < len; ++i) { hash += (hash << ) ...

  10. CentOS 7 安装配置 Gitlab

    centos:http://www.centos.org/download/ download:https://about.gitlab.com/downloads/ update:https://g ...