HDU 1724 Ellipse ——Simpson积分】的更多相关文章

/* hdu 1724 Ellipse simpson积分 求椭圆的部分面积 simpson积分法 http://zh.wikipedia.org/zh-tw/%E8%BE%9B%E6%99%AE%E6%A3%AE%E7%A7%AF%E5%88%86%E6%B3%95 */ #include<stdio.h> #include<math.h> const double eps=1e-8; inline double jue(double a) { return a>0?a:-…
[题目分析] 一看题目,直接把椭圆积分起来就可以了嘛. 然后发现椭圆比较难积分,还是算了吧. 用Simpson积分硬上. 大概就是用二次函数去拟合面积. [代码] #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <map> #include <set> #include <queue> #include &l…
Ellipse Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1868    Accepted Submission(s): 792 Problem Description Math is important!! Many students failed in 2+2’s mathematical test, so let's AC t…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1724 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define db double using namespace std; ; int T;db a,b,l,r; db f(db x){-x*x/a)*b);} db cal(db l,db r){*f((l+r)/…
Ellipse Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1977    Accepted Submission(s): 832 Problem Description Math is important!! Many students failed in 2+2’s mathematical test, so let's AC t…
题目链接:HDU 1724 Problem Description Math is important!! Many students failed in 2+2's mathematical test, so let's AC this problem to mourn for our lost youth.. Look this sample picture: A ellipses in the plane and center in point O. the L,R lines will…
simpson公式是用于积分求解的比较简单的方法(有模板都简单…… 下面是simpson公式(很明显 这个公式的证明我并不会…… (盗图…… 因为一段函数基本不可能很规则 所以我们要用自适应积分的方法 找了一道很水的积分题试试模板…… 关于simpson要*15 网上有很具体的证明过程…… (细节移步至:http://www2.math.umd.edu/~mariakc/teaching/adaptive.pdf #include<cstdio> #include<iostream>…
题目链接 题意:给出椭圆方程中的a和b,再给出l.r,求l到r的积分的二倍. 输出时要求精度控制为保留到小数点后3位,如下代码中,eps设为1e-9 1e-8时均TLE,1e-4可以AC,1e-3会WA 代码: #include<bits/stdc++.h> using namespace std; typedef long long LL; ; int n; double a,b,l,r; double F(double x) { -x*x/a/a); } double simpson(do…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1724 函数都给出来了,可以用辛普森积分: 一开始 eps = 1e-8 TLE了,答案只要三位小数,那么 eps = 1e-5 即可: 这次用了比较标准的写法^_^ 代码如下: #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; typ…
Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2677    Accepted Submission(s): 1208 Problem Description Math is important!! Many students failed in 2+2’s mathematical test, so let's AC this pro…