The area (hdu1071)积分求面积
The area
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7066 Accepted Submission(s):
4959
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.
For float may be not accurate enough, please use double instead of float.
#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)积分求面积的更多相关文章
- HDU_1071——积分求面积,抛物线顶点公式
Problem Description Ignatius bought a land last week, but he didn't know the area of the land becaus ...
- poj 1265 Area (Pick定理+求面积)
链接:http://poj.org/problem?id=1265 Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...
- poj 1654 Area (多边形求面积)
链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...
- hdu1071(定积分求面积)
太弱了,写了一下午,高中基础太差的孩子伤不起... 记住抛物线是关于x轴对称的. 而且抛物线的方程可以是: y=k(x-h)+c //其中(h,c)为顶点坐标 The area Time Limit ...
- bzoj1502 simpson求面积
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1502 题解: simpson积分求面积,s = (f(a)+f(b)+4*f(c))/6*Δx ...
- poj 3348--Cows(凸包求面积)
链接:http://poj.org/problem?id=3348 Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: ...
- P - Atlantis - hdu1542(求面积)
题意:rt 求面积......不计算重复面积(废话..)hdu1255 的弱化版,应该先做这道题在做那道题的. ******************************************** ...
- 编写一个矩形类,私有数据成员为矩形的长( len)和宽(wid),wid设置为0,有参构造函数设置和的值,另外,类还包括矩形的周长、求面积、取矩形的长度、取矩形的长度、取矩形的宽度、修改矩形的长度和宽度为对应的形参值等公用方法。
class Rectangle { private double len, wid; public Rectangle()//求矩形周长 { len = 0; wid = 0; } public Re ...
- HDU - 1255 覆盖的面积 (线段树求面积交)
https://cn.vjudge.net/problem/HDU-1255 题意 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. 分析 求面积并的题:https://www.cnbl ...
随机推荐
- 使用c# 实现冒泡排序
冒泡排序是一个经典的案例 实现原理就数与数前后两两比较,如果前面比后面大则交换位置.最终达到从小到大的顺序,这样的排序方式就是冒泡排序. //冒泡排序 ;//定义一个中间变量,用来交换值 , , , ...
- 《Python黑帽子:黑客与渗透测试编程之道》 玩转浏览器
基于浏览器的中间人攻击: #coding=utf-8 import win32com.client import time import urlparse import urllib data_rec ...
- gulp 打包错误 TypeError: Path must be string. Received undefined
Running gulp gives “path.js:7 throw new TypeError('Path must be a string. Received ' + inspect(path) ...
- angularJS详解
这篇文章转载 kooky798 的博客,http://blog.csdn.net/yy374864125/article/details/41349417, 写到这么详细也是没谁了,必须粉一个 1 ...
- 微信小程序自定义组件的使用以及调用自定义组件中的方法
在写小程序的时候,有时候页面的内容过多,逻辑比较复杂,如果全部都写在一个页面的话,会比较繁杂,代码可读性比较差,也不易于后期代码维护,这时候可以把里面某部分功能抽出来,单独封装为一个组件,也就是通常说 ...
- python传输文件
传输文件简单版 server端: import socket import struct import json import os share_dir = r'C:\py3Project\路飞\第三 ...
- Spring框架的演变
什么是Spring 如果想要解释Spring,那么最难的部分就是对其进行分类.通常情况下,Spring被描述为构建Java应用程序的轻量级框架,但这种描述带来了两个有趣的观点. 首先,与许多其他框架( ...
- oc中类的实例化及方法调用
上一篇我们讲了oop和类的创建,上一篇的重点我们回顾一下 类 对象 实例 方法 接口 这一篇我们来实现类的实例化,调用类中的公共参数和方法:类的实现在.m文件中,以下是实现代码: // // HuiT ...
- 读书笔记(05) - 事件 - JavaScript高级程序设计
HTML依托于JavaScript来实现用户与WEB网页之间的动态交互,接收用户操作并做出相应的反馈,而事件在此间则充当桥梁的重要角色. 日常开发中,经常会为某个元素绑定一个事件,编写相应的业务逻辑, ...
- JavaScript -- 数组Array
-----021-ActiveXObject.html----- <!DOCTYPE html> <html> <head> <meta http-equiv ...