HDU 1071 - The area
求曲线和直线围成的面积
求表达式,求积分
#include <iostream>
using namespace std;
double x[],y[];
int t;
double k,m;//fx1: y=kx+m
double a,b,c;//fx2: y=a(x-b)^2+c
void getfx1()
{
k=(y[]-y[])/(x[]-x[]);
m=y[]-k*x[];
}
void getfx2()
{
a=(y[]-y[])/(x[]-x[])/(x[]-x[]);
b=x[];
c=y[];
}
double getarea()
{
double f1=1.0/*a*x[]*x[]*x[]-(*a*b+k)/*x[]*x[]+(a*b*b+c-m)*x[];
double f2=1.0/*a*x[]*x[]*x[]-(*a*b+k)/*x[]*x[]+(a*b*b+c-m)*x[];
return f1-f2;
}
int main()
{
scanf("%d",&t);
while(t--)
{
for(int i=;i<=;i++) scanf("%lf%lf",&x[i],&y[i]);
getfx1();
getfx2();
printf("%.2lf\n",getarea());
}
}
HDU 1071 - The area的更多相关文章
- HDU 1071 The area(求三个点确定的抛物线的面积,其中一个点是顶点)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1071 The area Time Limit: 2000/1000 MS (Java/Others) ...
- HDU - 1071 - The area - 高斯约旦消元法 - 自适应辛普森法积分
http://acm.hdu.edu.cn/showproblem.php?pid=1071 解一个给定三个点的坐标二次函数某区域的积分值. 设出方程之后高斯消元得到二次函数.然后再消元得到直线. 两 ...
- HDU 1071 The area (数学定积分)
题意:求阴影部分面积. 析:没什么可说的,就是一个普通的定积分. 代码如下: #include <cstdio> #include <iostream> using names ...
- HDU 1071 The area ——微积分
[题目分析] 求二次函数和一次函数围成的面积. 先解方程求出一次函数和二次函数. 然后积分. 现在还是不会积分. [代码] #include <cstdio> #include <c ...
- 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 \) ...
- Simpson公式的应用(HDU 1724/ HDU 1071)
辛普森积分法 - 维基百科,自由的百科全书 Simpson's rule - Wikipedia, the free encyclopedia 利用这个公式,用二分的方法来计算积分. 1071 ( T ...
- HDU ACM 1071 The area 定积分计算
分析: 1.求抛物线方程F(x)=a*x^2+b*x+c: 2.求直线方程f(x)=k*x+b. 3.利用定积分计算F(x)-f(x)在x2到x3之间的面积. #include<iostream ...
- hdoj 1071 The area
The area Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- HDU 2125 Local area network
简单DP,N×M的网格其中有一条边坏掉了,问从起点到终点的放法数 有两种方法,一种是DP很好理解 //#define LOCAL #include <cstdio> #include &l ...
随机推荐
- iOS 之改变状态栏颜色
1.在工程中找到 info.plist 文件,点击“+”号,选择 View controller-based status bar appearance 并设为 NO 2.在 AppDelegate ...
- UVALive 4119 Always an integer (差分数列,模拟)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Always an integer Time Limit:3000MS M ...
- HttpServletResponse HttpServletRequest RequestDispatcher
HttpServletResponse HttpServletRequest RequestDispatcher 07. 五 / J2EE / 没有评论 一.以字节为单位向客户端发送中文数据1.服 ...
- 'data-'属性的作用是什么?
data-为前端开发者提供自定义的属性,这些属性集可以通过对象的dataset属性获取,不支持该属性的浏览器可以通过 getAttribute方法获取.ppk提到过使用rel属性,lightbox库推 ...
- C# 操作系统回收站
主要目的:对系统回收站的文件进行操作. 首先添加引用,引入shell32.dll. /// <summary> /// 对回收站的文件进行还原.删除.剪切等操作 /// </summ ...
- Anniversary party(POJ 2342 树形DP)
Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5767 Accepted: 3335 ...
- KeyTool
http://ln-ydc.iteye.com/blog/1335213 http://lukejin.iteye.com/blog/605634
- BZOJ 1458 士兵占领
http://www.lydsy.com/JudgeOnline/problem.php?id=1458 题意:n x m的棋盘,k个位置不能放,每行和每列都有要求至少的士兵,求能否有最少的满足条件的 ...
- C语言必背18个经典程序
C语言必背18个经典程序 1./*输出9*9口诀.共9行9列,i控制行,j控制列.*/ #include "stdio.h" main() {int i,j,result; for ...
- Qt中一些常用的格式转换
转自:http://blog.csdn.NET/yh_1988/article/details/7190356 用Qt经常头痛于一些格式不能通用的问题 在此记录备用 1 (20120112)QStri ...