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 ;
}
ZOJ 3235 Prototype的更多相关文章
- js闭包 和 prototype
function test(){ var p=200; function q(){ return p++; } return q; } var s = test(); alert(s()); aler ...
- PHP设计模式(六)原型模式(Prototype For PHP)
原型设计模式: 用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 原型设计模式简单的来说,顾名思义, 不去创建新的对象进而保留原型的一种设计模式. 缺点:原型设计模式是的最主要的缺点就 ...
- Function.prototype.toString 的使用技巧
Function.prototype.toString这个原型方法可以帮助你获得函数的源代码, 比如: function hello ( msg ){ console.log("hello& ...
- 分析js中的constructor 和prototype
在javascript的使用过程中,constructor 和prototype这两个概念是相当重要的,深入的理解这两个概念对理解js的一些核心概念非常的重要. 我们在定义函数的时候,函数定义的时候函 ...
- C#设计模式:原型模式(Prototype)及深拷贝、浅拷贝
原型模式(Prototype) 定义: 原型模式:用原型实例指定创建对象的种类,并且通过复制这些原型创建新的对象.被复制的实例被称为原型,这个原型是可定制的. Prototype Pattern也是一 ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- 关于JS的prototype
在接触JS的过程中,随着理解的深入会逐渐的理解一些比较深奥的理论或者知识,那么今天我们来介绍一下比较难理解的prototype和constructor. 初步理解: 在说prototype和const ...
- js中的原型prototype
var arr1 = new Array(12,34,98,43,38,79,56,1); arr1.sum=function (){ var result = 0; for(var i=0; i&l ...
- [基础] Array.prototype.indexOf()查询方式
背景 最近在看Redux源码,createStore用于注册一个全局store,其内部维护一个Listeren数组,存放state变化时所有的响应函数. 其中store.subscribe(liste ...
随机推荐
- JVM常用启动参数+常用内存调试工具
一.JVM常用启动参数 -Xms:设置堆的最小值. -Xmx:设置堆的最大值. -Xmn:设置新生代的大小. -Xss:设置每个线程的栈大小. -XX:NewSize:设置新生代的初始值. -XX:M ...
- Html.DropDownListFor() 二级联动 ($.getJSON)
Control: public ActionResult GetPositionName(int parentid) //发布新职位页面中的根据职位类别,获取职位名称 { List<Catego ...
- Deploy Openstack all-in-one Shell Script
Deploy Openstack all-in-one Shell Script At present(2015/10), the RDO deploment method can only inst ...
- Django Xadmin - 重构django admin
一.Django admin的执行流程 https://www.cnblogs.com/weihengblog/p/9122509.html 我的博客,介绍了django admin执行流程 二.Xa ...
- 【前端】上拉加载更多dropload.min.js的使用
代码如下:入职代码修改接口及html为自己的即可(下面主要展示js部分) <!DOCTYPE html><html> <head> <meta charset ...
- centos7 安装java和tomcat9
centos7 安装java 下载好java安装包后,首先是解压,然后配置环境变量. 在usr下新建Java文件夹,把java解压到Java文件夹中 新建文件夹 # mkdir /usr/Java 键 ...
- linux文件处理
取中间的行数作为train.txt sed -n '1000000,170910580p' train.txt > trainv1.txt 取前面的行数作为dev.txt head -10000 ...
- jmert jdbc request支持执行多条sql语句并设置jdbc字符集
1.jdbc request支持执行多条sql语句 在JDBC Connection Configuration中的sql连接字串中添加如下内容 allowMultiQueries=true 如下图: ...
- No.4 selenium学习之路之iframe
查看iframe: 1.top window ——可以直接进行定位
- sql server2012 企业版 百度云下载
链接: https://pan.baidu.com/s/1j7a6RWwpvSzG-sF7Dnexfw 提取码: 关注公众号[GitHubCN]回复获取