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 ...
随机推荐
- mark TODO:完善拦截规则;日志分析;web仪表盘展示;终极目标动态配置规则
- python3 关联规则Apriori代码模版
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from numpy import * def loadDataSet(): return [['a', ...
- git 回退到制定commit
git clone XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX git log -5 // 查看最近5个commit 回退命令:$ git reset --hard HEAD^ ...
- tcpdump查看某个端口数据
tcpdump -i eth0 -nn -A port tcpdump src
- HDFS文件系统
Hadoop 附带了一个名为 HDFS(Hadoop分布式文件系统)的分布式文件系统,专门存储超大数据文件,为整个Hadoop生态圈提供了基础的存储服务. 本章内容: 1) HDFS文件系统的特点,以 ...
- php在线编辑本地文件方法共享
public function testfile() { $cfile='F:\phpStudy\WWW\thinkphp5practise\NNWinLoseConfig.ini'; $cfileh ...
- selenium webdriver——XPath 定位
baidu.html代码如下 ....<form id="form" class="fm" action="/s" name=&quo ...
- Delphi7 [Fatal Error] ClassPas.pas(8): File not found: 'DesignIntf.dcu'
Delphi7 [Fatal Error] ClassPas.pas(8): File not found: 'DesignIntf.dcu' Add path to Project>Optio ...
- ICaptureGraphBuilder2::RenderStream 智能连接方法浅析
ICaptureGraphBuilder2::RenderStream HRESULT RenderStream( [in] const GUID *pCategory, [in] const GUI ...
- XMLHttpRequest.status 返回服务器状态码
XMLHttpRequest.status: 1xx-信息提示 这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个1xx响应. 100-继续. 101-切换协议. 2xx-成功 ...