UVA 10678 The Grazing Cow(椭圆定义)
来源:互联网 发布:淘宝为什么不卖烟 编辑:程序博客网 时间:2024/06/05 07:31
UVA 10678 The Grazing Cow(椭圆定义)
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=18&page=show_problem&problem=1619
题意:
有两个柱子,柱子之间的距离是d. 然后这两个柱子之间有一根长l(l>d)的绳子,绳子上有个圆环,圆环拉着一头牛. 问你牛的活动范围.
分析:
其实不论牛如何移动,它到两个柱子的距离之和总<=l的. 根据椭圆定义: 椭圆是平面内到两个固定点(两焦点)的距离之和是常数(2a>2c)的点的轨迹。
我们可以知道其实两个柱子就是焦点, 而柱子之间的距离为2*c, 绳子的长度为2*a, 最终椭圆的面积π*a*b 就是我们所求.
AC代码:
#include<cstdio>#include<cmath>using namespace std;const double PI=acos(-1);int main(){ int T; scanf("%d",&T); while(T--) { double d,l; scanf("%lf%lf",&d,&l); double a=l/2; double c=d/2; double b=sqrt(a*a-c*c); printf("%.3lf\n",PI*a*b); } return 0;}
0 0
- UVA 10678 The Grazing Cow(椭圆定义)
- UVA 10678 The Grazing Cow
- UVa 10678 - The Grazing Cow
- UVA 10678 || The Grazing Cow(计算椭圆面积 S = PI * a* b 长短半轴a,b
- UVa10678 - The Grazing Cow
- POJ 3042 Grazing on the Run
- poj3042 Grazing on the Run[区间dp]
- poj 3042 Grazing on the Run
- 1694: [Usaco2007 Demo]Grazing on the Run
- poj 3042 Grazing on the Run(区间DP,三维DP)
- POJ 3042 Grazing on the Run (区间DP)
- BZOJ 1694 [Usaco2007 Demo]Grazing on the Run DP
- POJ 3042 Grazing on the Run 区间dp
- 【bzoj1742】[Usaco2005 nov]Grazing on the Run 边跑边吃草
- [bzoj1742][Usaco2005 nov][DP]Grazing on the Run 边跑边吃草
- POJ3267 The Cow Lexicon
- 3267 The Cow Lexicon
- The Cow Lexicon
- Android锁屏状态下弹出activity
- 搜索“动态调试工具”搜到了“OllyDbg”
- 京东在线客服实时消息
- SVN提交报错"Commit blocked by pre-commit hook"的解决办法
- 黑马程序员——Java多线程1
- UVA 10678 The Grazing Cow(椭圆定义)
- itune服务器mp3文件unicode转换
- CentOS 6.4 安装chrome
- 黑马程序员——类方法和关键字self
- 移动开发
- 常见算法在实际项目中的应用
- ubuntu下安装基本开发套件
- 【微软100题】求1+2+…+n
- stl---Deque小结