hdu 1071 The area【定积分】】的更多相关文章

传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1071 The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12095    Accepted Submission(s): 8490 Problem Description Ignatius bought a land last…
分析: 1.求抛物线方程F(x)=a*x^2+b*x+c: 2.求直线方程f(x)=k*x+b. 3.利用定积分计算F(x)-f(x)在x2到x3之间的面积. #include<iostream> using namespace std; double fun(double a,double b,double c,double d,double k,double x) { return a*x*x*x/3.0-(2.0*a*b+k)*x*x/2.0+(a*b*b+c-d)*x; } int m…
题意:求阴影部分面积. 析:没什么可说的,就是一个普通的定积分. 代码如下: #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…
用顶点式\( a(x-h)^2+k=y \)解方程,转化为\(ax^2+bx+c=y \)的形式,然后对二次函数求定积分\( \frac{ax^3}{3}+\frac{bx^2}{2}+cx+C \)即可.(其实我不知道那个C是干什么用的反正这里不用加. #include<iostream> #include<cstdio> using namespace std; int T; double x1,x2,x3,y1,y2,y3,a,b,c,h,k; double f(double…
http://acm.hdu.edu.cn/showproblem.php?pid=1071 解一个给定三个点的坐标二次函数某区域的积分值. 设出方程之后高斯消元得到二次函数.然后再消元得到直线. 两次积分然后相减就可以了. 把自适应辛普森改成了传入函数指针的形式,有点多此一举. 可以这样做的原因,是因为这道题保证要求的区域都是在第一象限,否则不能直接定积分. 语言:G++ #include<bits/stdc++.h> using namespace std; typedef long lo…
求曲线和直线围成的面积 求表达式,求积分 #include <iostream> using namespace std; ],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[]…
[题目分析] 求二次函数和一次函数围成的面积. 先解方程求出一次函数和二次函数. 然后积分. 现在还是不会积分. [代码] #include <cstdio> #include <cstring> #include <cstdlib> //#include <cmath> #include <set> #include <map> #include <string> #include <algorithm> #…
辛普森积分法 - 维基百科,自由的百科全书 Simpson's rule - Wikipedia, the free encyclopedia 利用这个公式,用二分的方法来计算积分. 1071 ( The area ) #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std;…
The area Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8388    Accepted Submission(s): 5888 Problem Description Ignatius bought a land last week, but he didn't know the area of the land becaus…
题意:就是求给你一个抛物线的三个点,第一个给定的点是抛物线的顶点,让你求直线p2p3与抛物线的定积分 思路:因为题目条件给了顶点,所以直接用抛物线的顶点式去求. 本弱弱数学太差.还得复习一下公式 #include<cstdio> #include<cmath> double a,h,k; double f(double x) { return 1.0/3.0*a*(x-h)*(x-h)*(x-h)+k*x; } int main() { double x2,y2,x3,y3; in…