HDU 1071 The area (数学定积分)
题意:求阴影部分面积。
析:没什么可说的,就是一个普通的定积分。
代码如下:
#include <cstdio>
#include <iostream> using namespace std; int main(){
int T; cin >> T;
double x0, y0, x1, y1, x2, y2, k, b, a, c, h, s;
while(T--){
scanf("%lf %lf %lf %lf %lf %lf",&x0, &y0, &x1, &y1, &x2, &y2);
k = (y2-y1) / (x2-x1);
b = y1 - k*x1;
h = x0;
c = y0;
a = (y1-c) / ((x1-h)*(x1-h));
s = (a*x2*x2*x2/3-(2*a*h+k)*x2*x2/2+(a*h*h+c-b)*x2)-(a*x1*x1*x1/3-(2*a*h+k)*x1*x1/2+(a*h*h+c-b)*x1);
printf("%.2lf\n", s);
}
return 0;
}
HDU 1071 The area (数学定积分)的更多相关文章
- 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 \) ...
- 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 <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 ...
- HDU 2.1.7 (求定积分公式)
The area Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- HDU 4816 Bathysphere(数学)(2013 Asia Regional Changchun)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 Problem Description The Bathysphere is a spheric ...
随机推荐
- Git自动换行符
http://blog.csdn.net/jonathan321/article/details/51988242?locationNum=2 不同的操作系统有不同的换行符格式,跨平台协作时需要考虑版 ...
- 【白银组】codevs_1160 蛇形矩阵
#include <iostream> using namespace std; #define M 100 int a[M][M]; void pt( int n ) { for ( i ...
- ivy antlib shemalocation
<?xml version="1.0" encoding="UTF-8"?> <project name="yourproject& ...
- malloc/free与new/delete的不同及注意点
#include<iostream> using namespace std; class Obj{ public : Obj(){cout<<"Initializa ...
- apache make
https://jingyan.baidu.com/article/7e4409533d7f0f2fc0e2ef91.html 1. apr apr-util http://archive.apach ...
- 面试总结之数据结构(Data Structure)
常用数据结构及复杂度 http://www.cnblogs.com/gaochundong/p/3813252.html 常用数据结构的时间复杂度 Data Structure Add Find De ...
- win10开启开发人员模式
工具: win10 方法如下: 1.在Windows10系统桌面,点击开始菜单,然后在弹出窗口中选择“设置”菜单项 2.在打开的设置窗口中,选择“更新和安全”图标,并点击打开更新和安全窗口 3.在打开 ...
- Linux系统编译Win32版本adb
源码版本:android 7.0 步骤1:source build/envsetup.sh 步骤2:lunch 步骤3:选择编译设备目标 步骤4:make adb USE_MINGW=y 下面是应对编 ...
- cesium初始化参数
var viewer = new Cesium.Viewer('cesiumContainer',{ animation:false, //动画控制不显示 //baseLayerPicker:fals ...
- 常用工具&网址
工具 I tell you http://www.win7999.com/news/197912345.html VisualSVN Server(免费) http://www.visualsvn.c ...