Turn the corner
来源:互联网 发布:广电总局对于网络剧 编辑:程序博客网 时间:2024/05/21 22:21
Turn the corner
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 715 Accepted Submission(s): 322Problem Description
Mr. West bought a new car! So he is travelling around the city.
One day he comes to a vertical corner. The street he is currently in has a width x, the street he wants to turn to has a width y. The car has a length l and a width d.
Can Mr. West go across the corner?
One day he comes to a vertical corner. The street he is currently in has a width x, the street he wants to turn to has a width y. The car has a length l and a width d.
Can Mr. West go across the corner?
Input
Every line has four real numbers, x, y, l and w.
Proceed to the end of file.
Proceed to the end of file.
Output
If he can go across the corner, print "yes". Print "no" otherwise.
Sample Input
10 6 13.5 410 6 14.5 4
Sample Output
yesno
题目大意:给出转角的x,y 车的长度lkuanduw 判断是都可以转弯
#include <iostream>#include<stdio.h>#include<cmath>using namespace std;const double PI=3.14159265;double x,y,l,w;double a,b,c,d;double solve(double p){ double s=l*cos(p)+w*sin(p)-x; double h=s*tan(p)+w*cos(p); return h;}int main(){ while(cin>>x>>y>>l>>w) { a=0; b=PI/2; while(b-a>1e-6) { c=(2*a+b)/3; d=(a+2*b)/3; if(solve(c)>solve(d)) b=d; else a=c; } if(solve(b)<=y) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0;}
阅读全文
1 0
- Turn the corner
- Turn the corner
- HDU Turn the corner
- Turn the corner+三分法
- HDU2438 Turn the corner
- Turn the corner
- hdu2438 Turn the corner
- 5Turn the corner
- Turn the corner
- 1005 Turn the corner
- 1005 Turn the corner
- Turn the corner
- 1005 Turn the corner
- Turn the corner
- 1005-Turn the corner
- 1005 Turn the corner
- Turn the corner
- Turn the corner HDU
- Collections类
- 通过WinSCP来进行win和linux的双向传输
- Android如何先显示一张图片,延时几秒后,再自动跳转到另一个页
- Install InfluxDB on Ubuntu 16.04 LTS
- Java内存不足之PermGen space错误探究
- Turn the corner
- 斗地主之用蚁群算法整理牌型-概述
- Uva.10815 Andy's First Dictionary
- sqlite入门基础(一):sqlite3_open,sqlite3_exec,slite3_close
- Unable to open debugger port
- JAVA开发之 37 使用数组输出古诗《春晓》
- Swagger搭配Springboot使用
- 基础的一个动画
- log4j错误统计