热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ZOJ3235Prototype

PrototypeTimeLimit:1SecondMemoryLimit:32768KBPrototypeisa3Dgamewhichallowyoutocontrolapers
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.

,,
 1 #include  
 2 #include<string.h>  
 3 #include  
 4 #include  
 5 #include  
 6 #include  
 7 #include  
 8 #include<set>  
 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             else
52             {
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

ZOJ 3235 Prototype


推荐阅读
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • CentOS7源码编译安装MySQL5.6
    2019独角兽企业重金招聘Python工程师标准一、先在cmake官网下个最新的cmake源码包cmake官网:https:www.cmake.org如此时最新 ... [详细]
  • c# – UWP:BrightnessOverride StartOverride逻辑 ... [详细]
  • 深入理解OAuth认证机制
    本文介绍了OAuth认证协议的核心概念及其工作原理。OAuth是一种开放标准,旨在为第三方应用提供安全的用户资源访问授权,同时确保用户的账户信息(如用户名和密码)不会暴露给第三方。 ... [详细]
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 技术分享:从动态网站提取站点密钥的解决方案
    本文探讨了如何从动态网站中提取站点密钥,特别是针对验证码(reCAPTCHA)的处理方法。通过结合Selenium和requests库,提供了详细的代码示例和优化建议。 ... [详细]
  • Linux 系统启动故障排除指南:MBR 和 GRUB 问题
    本文详细介绍了 Linux 系统启动过程中常见的 MBR 扇区和 GRUB 引导程序故障及其解决方案,涵盖从备份、模拟故障到恢复的具体步骤。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 深入理解 SQL 视图、存储过程与事务
    本文详细介绍了SQL中的视图、存储过程和事务的概念及应用。视图为用户提供了一种灵活的数据查询方式,存储过程则封装了复杂的SQL逻辑,而事务确保了数据库操作的完整性和一致性。 ... [详细]
  • 本文详细介绍了 Dockerfile 的编写方法及其在网络配置中的应用,涵盖基础指令、镜像构建与发布流程,并深入探讨了 Docker 的默认网络、容器互联及自定义网络的实现。 ... [详细]
  • PyCharm下载与安装指南
    本文详细介绍如何从官方渠道下载并安装PyCharm集成开发环境(IDE),涵盖Windows、macOS和Linux系统,同时提供详细的安装步骤及配置建议。 ... [详细]
  • 资源推荐 | TensorFlow官方中文教程助力英语非母语者学习
    来源:机器之心。本文详细介绍了TensorFlow官方提供的中文版教程和指南,帮助开发者更好地理解和应用这一强大的开源机器学习平台。 ... [详细]
  • 本文介绍了如何使用 Spring Boot DevTools 实现应用程序在开发过程中自动重启。这一特性显著提高了开发效率,特别是在集成开发环境(IDE)中工作时,能够提供快速的反馈循环。默认情况下,DevTools 会监控类路径上的文件变化,并根据需要触发应用重启。 ... [详细]
author-avatar
机智的树獭
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有