HDU1724 - 积分
2013-08-29 19:21
183 查看
Ellipse
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 876 Accepted Submission(s): 280
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 be vertical through the X-axis. The problem is calculating the blue intersection area. But calculating the intersection area is dull, so I have turn to you, a talent of programmer. Your task
is tell me the result of calculations.(defined PI=3.14159265 , The area of an ellipse A=PI*a*b )
Input
Input may contain multiple test cases. The first line is a positive integer N, denoting the number of test cases below. One case One line. The line will consist of a pair of integers a and b, denoting the ellipse equation
,
A pair of integers l and r, mean the L is (l, 0) and R is (r, 0). (-a <= l <= r <= a).
Output
For each case, output one line containing a float, the area of the intersection, accurate to three decimals after the decimal point.
Sample Input
2
2 1 -2 2
2 1 0 2
Sample Output
6.283
3.142
Author
威士忌
Source
HZIEE 2007 Programming Contest
简单高数题.
#include<iostream> #include<cstdio> #include<cmath> using namespace std; double a,b,l,r; double f(double x) { double t=asin(x/a); return 0.5*a*b*(t+0.5*sin(2*t)); } int main() { int T; cin>>T; while(T--) { cin>>a>>b>>l>>r; printf("%.3lf\n",2*(f(r)-f(l))); } return 0; }
相关文章推荐
- HDU1724[辛普森公式求积分]Ellipse
- 【自适应辛普森积分】hdu1724 Ellipse
- hdu1724(定积分&&Simpson积分)
- HDU1724 Ellipse(数值积分)
- [HDU1724]Ellipse(辛普森积分)
- 发我我价格万恶陪我积分
- 自适应辛普森积分
- 103 不定积分复习:换元法之第一类、第二类;分部积分法;两类重要的不定积分
- Android 自定义View实现QQ运动积分抽奖转盘
- 用Python学《微积分B》(重积分)
- 怎么提高CSDN博客积分和排名呢
- 数值积分之Simpson公式与梯形公式
- CSDN积分排名规则
- 定积分的基本性质4 绝对可积性
- 牛顿-莱布尼茨公式求积分例题
- 学以致用——CSDN概要数据(积分、篇数、访问总量)的多元线性预测
- 【笔记】机器学习所涉及到的“积分学”知识
- 怎么不用积分在百度文库阅读文档?
- Android Studio3.0输入法卡顿修复方法(免积分)!不能用过来打我
- 龙贝格求积公式 c语言实现 数值积分