ZOJ 3235 Prototype
Prototype
Time Limit: 1 Second Memory Limit: 32768 KB
Prototype is a 3D game which allow you to control a person named Alex with much super ability to finish missions with gut along. Alex has the abilitiy to glide in the sky. What's more, he can make at most 3-level glide, which means before he lands at the ground, he has two chances to adjust and perform another glide. We assume that each time he perform a glide, his vertical speed become zero and glide forward with a new speed. And the orbit will be a parabola due to the gravity.
To make the problem easier, we now only consider at most 2-level glide. The binomial coefficient of the mathematical equation of the fist glide will be given as -a and the second will be -b, which means the formulations are (y - y0) = -ax2 and (y - y0) = -b(x - x0)2. As the picture above, Alex perform a glide from the top of Building1, make a 1-level or a 2-level glide and lands exactly at point B. What's more, there is Building2 standing between Building1 and point B. Alex has to avoid crashing onto it.
Input
There are no more than 15 cases. Proceed till the end of file.
Each case contains only one line of six real number h1,
h2, d1, d2, a,
b. h1 is the height of Building1,
h2 is the height of Building2, d1 is the
X-distance between Building1 and Building2, d2 is the
X-distance between point B and Building1. These four numbers are in [0, 1000]
, and satisfies d1 < d2. And a and b are in
(0, 1000].
Output
If it is possible for Alex to land exactly on point B, print Yes, otherwise
print No.
Sample Input
25 1 6 7 1 1
4 3 1 2 1 1
Sample Output
Yes
Yes
HINT
In case 2, Alex just glide over the building2 and do not crash onto it.
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std; int main()
{
double h1,h2,d1,d2,a,b,x[];
while (scanf("%lf%lf%lf%lf%lf%lf",&h1,&h2,&d1,&d2,&a,&b)!=EOF)
{
if (h1/b-d2*d2>)
{
printf("No\n");
continue;
}
double derta=*b*b*d2*d2-*(a+b)*(b*d2*d2-h1);
if (derta<)
{
printf("No\n");
continue;
}
x[]=(*b*d2+sqrt(derta))/(*(a+b));
x[]=(*b*d2-sqrt(derta))/(*(a+b));
if(x[]<&&x[]<)
{
printf("No\n");
continue;
}
int flag[]={,};
for(int i=;i<;i++)
{
if(d1-x[i]>)
{
//if((-b*pow(d1-x[i],2)+(-a*pow(x[i],2)+h1))>=h2)
if(b*(d1-d2)*(d1-d2)>=h2)
{
flag[i]=;
break;
}
}
else
{
if((-a*pow(d1,)+h1)>=h2)
{
flag[i]=;
break;
}
}
}
if (flag[]==||flag[]==)
printf("Yes\n");
else
printf("No\n");
}
return ;
}
最新文章
- WCF 定义SOAP和REST风格的webservice
- pyside窗口关闭触发事件
- NPOI2.0学习(一)
- .NET安全审核检查表
- 针对Xcode的警告忽略消除处理
- JMeter学习-018-JMeter 配置元件之-HTTP信息头管理器-实现 Cookie 登录
- 数据库性能之--ibatis cache应用
- netty常用代码
- 给windows 7安装文件添加USB3.0驱动
- 【Qt】Qt之自定义界面(窗体缩放-跨平台终极版)【转】
- 百度地图LV1.5实践项目开发工具类bmap.util.jsV1.0
- H3C inode for OSX 10.10 校园网客户端亲测可用
- 附近的人,附近的卖家(geohash+前缀树)
- [看图说话]在VMware Workstation 9中安装Mac OS X 10.8 Mountain Lion
- Android软键盘的隐藏显示、事件监听的代码
- Signalr实现消息推送
- ubuntu16.04下Hyperledger之搭建Fabric环境简单操作(五步启动e2e_cli)
- 20135202闫佳歆--week3 构造一个简单的Linux系统MenuOs--学习笔记
- 【代码审计】711cms_V1.0.5 目录遍历漏洞分析
- hdu - 1072(dfs剪枝或bfs)