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 ...
随机推荐
- UWP FillRowViewPanel
最近有童鞋有这种需求,说实话我不知道这个Panel怎么起名字. 效果连接https://tuchong.com/tags/风光/ 下面是我做成的效果,可以规定每个Row的Items个数 2个 3个 4 ...
- ceph 源码安装 configure: error: "Can't find boost spirit headers"
问题:configure: error: "Can't find boost spirit headers" 解决: 推荐:sudo apt-get install libboos ...
- [初识]使用百度AI接口,图灵机器人实现简单语音对话
一.准备 1.百度ai开放平台提供了优质的接口资源https://ai.baidu.com/ (基本免费) 2.在语音识别的接口中, 对中文来说, 讯飞的接口是很好的选择https://www.xf ...
- Android------TabLayout的使用
https://www.jianshu.com/p/2b2bb6be83a8 主要放在 -------> Design库中的TabLayout的使用. margin和padding的区别 外边距 ...
- 简单的C# Socket通信实例
一.套接字(socket)概念 套接字(socket)是通信的基石,是支持TCP/IP协议的网络通信的基本操作单元.它是网络通信过程中端点的抽象表示,包含进行网络通信必须的五种信息:连接使用的协议,本 ...
- VS 快捷键设置
工具 --> 选项 --> 环境 --> 键盘
- 使用命令行工具npm新创建一个vue项目
使用vue开发项目的前期工作可以参考前面写的: Vue环境搭建及node安装过程整理 Vue.js 提供一个官方命令行工具,可用于快速搭建大型单页应用.该工具提供开箱即用的构建工具配置,带来现代化的 ...
- c++中char类型字符串拼接以及int类型转换为char类型 && 创建文件夹
如下所示: #include <iostream> #include <windows.h> #include <cstring> using namespace ...
- C# 字符串操作基本过程(Equals、Compare、EndsWith等处理方法)
本文只介绍了比较方法,但是EndsWith,IndexOf等方法均采用相同的过程,先设置CultureInfo(一般情况下调用当前线程的CultureInfo,该语言文化可以通过控制面板设置),然后调 ...
- webstorm引用ESLint进行静态代码检查
安装 ESLint 基于 Node 平台,所以 Nodejs 是必须安装的,然后通过 npm 安装 ESLint 包,至于全局安装还是作为开发依赖安装,取决于个人. 然后在 WebStorm 中,打开 ...