博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ZOJ 3235 Prototype
阅读量:5064 次
发布时间:2019-06-12

本文共 2839 字,大约阅读时间需要 9 分钟。

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 14 3 1 2 1 1

Sample Output

YesYes

HINT

In case 2, Alex just glide over the building2 and do not crash onto it.

1 #include
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 #include
11 #include
12 #include
13 #include
14 using namespace std;15 16 int main()17 {18 double h1,h2,d1,d2,a,b,x[2];19 while (scanf("%lf%lf%lf%lf%lf%lf",&h1,&h2,&d1,&d2,&a,&b)!=EOF)20 {21 if (h1/b-d2*d2>0) 22 {23 printf("No\n");24 continue;25 }26 double derta=4*b*b*d2*d2-4*(a+b)*(b*d2*d2-h1);27 if (derta<0) 28 {29 printf("No\n");30 continue;31 }32 x[0]=(2*b*d2+sqrt(derta))/(2*(a+b));33 x[1]=(2*b*d2-sqrt(derta))/(2*(a+b));34 if(x[0]<0&&x[1]<0)35 {36 printf("No\n");37 continue;38 }39 int flag[2]={ 0,0};40 for(int i=0;i<2;i++)41 {42 if(d1-x[i]>0)43 {44 //if((-b*pow(d1-x[i],2)+(-a*pow(x[i],2)+h1))>=h2)45 if(b*(d1-d2)*(d1-d2)>=h2) 46 {47 flag[i]=1;48 break;49 } 50 }51 else52 {53 if((-a*pow(d1,2)+h1)>=h2)54 {55 flag[i]=1;56 break;57 } 58 }59 }60 if (flag[0]==1||flag[1]==1) 61 printf("Yes\n");62 else 63 printf("No\n");64 }65 return 0;66 }
View Code

 

转载于:https://www.cnblogs.com/qscqesze/p/3871002.html

你可能感兴趣的文章
POP的Stroke动画
查看>>
线程同步机制初识 【转载】
查看>>
Oracle 游标使用全解
查看>>
Spring mvc annotation and xml example
查看>>
关于报错The specified child already has a parent的解决办法
查看>>
SQL语句在查询分析器中可以执行,代码中不能执行
查看>>
yii 1.x 添加 rules 验证url数组
查看>>
html+css 布局篇
查看>>
银行排队问题(详解队列)
查看>>
input输入提示历史记录
查看>>
序列化和反序列化(1)---[Serializable]
查看>>
linux命令**50
查看>>
系列1:C++语言细节
查看>>
PyCharm设置Python版本
查看>>
数据查询(2)-高级查询(芮)
查看>>
UIImage应用与内存管理
查看>>
java:数据结构(二)栈的应用(括号匹配)
查看>>
RCP学习(1)
查看>>
BZOJ.4543.[POI2014]Hotel加强版(长链剖分 树形DP)
查看>>
BZOJ.1071.[SCOI2007]组队(思路)
查看>>