HDU 1071 The area ——微积分
【题目分析】
求二次函数和一次函数围成的面积。
先解方程求出一次函数和二次函数。
然后积分。
现在还是不会积分。
【代码】
#include <cstdio>
#include <cstring>
#include <cstdlib>
//#include <cmath> #include <set>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <iostream>
#include <queue> using namespace std; #define maxn 20005
#define mlog 16
#define inf (0x3f3f3f3f) void Finout()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
#endif
} int Getint()
{
int x=0,f=1; char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0'&&ch<='9') {x=x*10+ch-'0'; ch=getchar();}
return x*f;
} int T;
double x1,x2,x3,y1,y2,y3;
double a,b,c,t,k; int main()
{
Finout();
T=Getint();
while (T--)
{
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
k=(y3-y2)/(x3-x2);
t=y3-x3*k;
a=(y2-y1)/((x1-x2)*(x1-x2));
b=-x1*2*a;
c=y1-a*x1*x1-b*x1;
printf("%.2f\n",(a/3*x3*x3*x3+(b-k)/2*x3*x3+x3*(c-t))-(a/3*x2*x2*x2+(b-k)/2*x2*x2+x2*(c-t)));
}
}
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 <iostream> using namespace std; ],y[]; int t; double k,m;//fx1: ...
- HDU 1071 The area (数学定积分)
题意:求阴影部分面积. 析:没什么可说的,就是一个普通的定积分. 代码如下: #include <cstdio> #include <iostream> using names ...
- 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 ...
- TZOJ 1210 The area(微积分)
描述 Ignatius bought a land last week, but he didn't know the area of the land because the land is enc ...
随机推荐
- [windows]设置开机取消登录窗口选项直接进入桌面
步骤: 菜单--〉运行--〉输入:control passwords2或rundll32 netplwizdll,UsersRunDll--〉用户账户-用户-取消勾选“要使用本机,用户必须输入用户名和 ...
- Spring下读取properties文件
由于在spring的xml文件中配置了 <bean id="validator" class="org.springframework.validation.bea ...
- 自己开发的在线视频下载工具,基于Java多线程
比如这个在线视频: 我们可以正常播放,但是找不到下载按钮. 打开Chrome开发者工具,在Network标签页里能看到很多网络传输请求: 随便看一个请求的响应,发现类型为video,大小为500多k. ...
- 优先队列的使用——Expedition
一.题目描述 你需要驾驶一辆卡车行驶L单位距离.最开始时,卡车上有P单位的汽油.卡车每开1单位距离需要消耗1单位的汽油.如果在途中车上的汽油耗尽,卡车就无法继续前行,因而无法到达终点.中途共有N个加油 ...
- div+css实现几种经典布局的详解
一.左右两侧,左侧固定宽度200px,右侧自适应占满 <div class="divBox"> <div class="left">&l ...
- Robot Framework(十) 执行测试用例——测试执行
3.2测试执行 本节描述如何执行从解析的测试数据创建的测试套件结构,如何在失败后继续执行测试用例,以及如何正常停止整个测试执行. 3.2.1执行流程 执行套房和测试 设置和拆卸 执行顺序 3.2.2继 ...
- python_110_反射
class Dog(object): def __init__(self,name): self.name=name def eat(self): print('%s is eating '%self ...
- 测试框架 Mocha 实例教程(转载:来自阮一峰的一篇文章)
Mocha(发音"摩卡")诞生于2011年,是现在最流行的JavaScript测试框架之一,在浏览器和Node环境都可以使用. 所谓"测试框架",就是运行测试的 ...
- OpenCV2:第十一章 图像转换
一.简介 二.例子 #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #inclu ...
- Tarjan求强联通分量+缩点
提到Tarjan算法就不得不提一提Tarjan这位老人家 Robert Tarjan,计算机科学家,以LCA.强连通分量等算法闻名.他拥有丰富的商业工作经验,1985年开始任教于普林斯顿大学.Tarj ...