博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Little Jumper---(三分)
阅读量:5122 次
发布时间:2019-06-13

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

Description

      Little frog Georgie likes to jump. Recently he have discovered the new playground that seems the perfect place to jump.

      Recently the new jumping exercise has become very popular. Two vertical walls are placed on the playground, each of which has a hole.

      The lower sides of the holes in the walls are on heights b1 and b2 respectively, and upper sides on heights t1 and t2. Walls are parallel and placed on distance l from each other.

      The jumper starts at the distance ds from the first wall. It jumps through the first hole and lands between the walls. After that from that point he jumps through the second hole. The goal is to land exactly at the distance df from the second wall.

      Let us describe the jump. The jumper starts from the specified point and starts moving in some chosen direction with the speed not exceeding some maximal speed v, determined by the strength of the jumper. The gravity of g forces him down, thus he moves along the parabolic trajectory.

      The jumper can choose different starting speeds and different directions for his first and second jump.

      Of course, The jumper must not attempt to pass through the wall, although it is allowed to touch it passing through the hole, this does not change the trajectory of the jump. The jumper is not allowed to pass through both holes in a single jump.

      Find out, what must be the maximal starting speed of the jumper so that he could fulfil the excersise.

Input

      Input file contains one or more lines, each of which contains eight real numbers, separated by spaces and/or line feeds. They designate b1, t1, b2, t2, l, ds, df and g. All numbers are in range from 10-2 to 103, t1 ≥ b1 + 10-2, t2 ≥ b2 + 10-2.

      Input file contains at most 1000 test cases.

Output

      For each line of the input file output the smallest possible maximal speed the jumper must have to fulfil the exercise. If it is impossible to fulfil it, output -1. 
Your answer must be accurate up to 10-4.

Sample Input

0.3 1.0 0.5 0.9 1.7 1.2 2.3 9.80.6 0.8 0.6 0.8 2.4 0.3 1.5 0.7

Sample Output

5.28831.3127
#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;const double pi=acos(-1);const int maxn=100005;const int INF=0x3f3f3f;const double eps=1e-12;int dcmp(double x){ if(fabs(x)
0)return 1; return -1;}//精度为eps的比较double b1,t1,b2,t2,l,ds,df,g;double calu(double dis,double x,double b,double t){ double v=0; double mid=dis/2; double a=-1/dis; double y=a*x*x+x; if(y>=b&&y<=t){ double h=a*mid*mid+mid; double t,vx,vy; t=sqrt(2*h/g); vx=dis/t/2; vy=g*t; v=vx*vx+vy*vy; } else{ if(y
eps){ mid=(high+low*2)/3; midd=(low+high*2)/3; if(solve(mid)

 

转载于:https://www.cnblogs.com/chen9510/p/5539309.html

你可能感兴趣的文章
拉格朗日乘子法 那些年学过的高数
查看>>
vs code 的便捷使用
查看>>
用户空间与内核空间,进程上下文与中断上下文[总结]
查看>>
JS 中的跨域请求
查看>>
JAVA开发环境搭建
查看>>
cassandra vs mongo (1)存储引擎
查看>>
Visual Studio基于CMake配置opencv1.0.0、opencv2.2
查看>>
SDN第四次作业
查看>>
django迁移数据库错误
查看>>
洛谷 1449——后缀表达式(线性数据结构)
查看>>
Data truncation: Out of range value for column 'Quality' at row 1
查看>>
字符串处理
查看>>
HtmlUnitDriver 网页内容动态抓取
查看>>
ad logon hour
查看>>
罗马数字与阿拉伯数字转换
查看>>
Eclipse 反编译之 JadClipse
查看>>
Python入门-函数
查看>>
距离公式汇总以及Python实现
查看>>
Window7上搭建symfony开发环境(PEAR)
查看>>
Linux内核态、用户态简介与IntelCPU特权级别--Ring0-3
查看>>