【HDU 2438】 Turn the corner
来源:互联网 发布:python oxc000007b 编辑:程序博客网 时间:2024/05/16 10:25
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2438
题意:
给出多组x,y,l,d,回答能否通过
题解:
图好丑啊啊啊啊啊啊啊啊!!!!!
数学题。。。。。
难度主要在于列个函数关系式
只要保证(PH)max<=y即可
然后证明这个函数在(0,π/2)是单峰的
蒟蒻懒(bu)得(hui)证明,只好刷表~(≧▽≦)/~啦啦啦
然后愉快地套一个三分就OK了
暴力刷表结果如下orz
然后代码
#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>#include<cmath>using namespace std;double x,y,l,w;const double eps=1e-6;const double pi=acos(-1.0);double calc(double angle){ return (-x+l*sin(angle)+w/cos(angle))/tan(angle);}int main(){ while(scanf("%lf%lf%lf%lf",&x,&y,&l,&w)!=EOF) { double ll=0,rr=pi/2,midx,midy; while(rr-ll>eps) { midx=(2*ll+rr)/3; midy=(ll+2*rr)/3; if(calc(midx)<calc(midy)) ll=midx; else rr=midy; } if(calc(ll)<=y) printf("yes\n"); else printf("no\n"); } return 0;}
0 0
- HDU 2438 Turn the corner
- hdu 2438 Turn the corner
- HDU 2438 Turn the corner
- HDU 2438 Turn the corner
- HDU 2438 Turn the corner
- Turn the corner HDU-2438
- 【HDU 2438】 Turn the corner
- HDU 2438 Turn the corner
- HDU Turn the corner
- Turn the corner HDU
- hdu 2438 - Turn the corner(三分)
- hdu 2438Turn the corner(三分)
- HDU 2438 Turn the corner(三分)
- HDU 2438 Turn the corner 三分法
- hdu 2438 Turn the corner(三分)
- HDU 2438 Turn the corner(三分)
- hdu-2438-Turn the corner(三分)
- HDU 2438 Turn the corner 三分
- Windows 10 x64位安装MySQL 5.7.18x64
- MQ消息中间件在分布式系统中的作用(三)
- 【解题报告】UVA10603 Fill BFS
- Leetcode学习(11)—— Island Perimeter
- vue2.0多条件搜索组件
- 【HDU 2438】 Turn the corner
- ubuntu16.04 切换 python 版本
- Hashtable 、ConcurrentHashMap源码学习
- java虚拟机--简单介绍
- BFS-1
- android电池剩余使用时间
- 539. Minimum Time Difference
- 二分图匹配——HDU 5943
- matlab面向对象教程【1】迷宫生成算法案例