Little Jumper---(三分)
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
Sample Input
0.3 1.0 0.5 0.9 1.7 1.2 2.3 9.8
0.6 0.8 0.6 0.8 2.4 0.3 1.5 0.7
Sample Output
5.2883
1.3127
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <math.h>
#include <vector>
#include <string>
#include <utility>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <functional> using namespace std;
const double pi=acos(-);
const int maxn=;
const int INF=0x3f3f3f;
const double eps=1e-;
int dcmp(double x){
if(fabs(x)<eps)return ;
if(x>)return ;
return -;
}//精度为eps的比较
double b1,t1,b2,t2,l,ds,df,g;
double calu(double dis,double x,double b,double t){
double v=;
double mid=dis/;
double a=-/dis;
double y=a*x*x+x;
if(y>=b&&y<=t){
double h=a*mid*mid+mid;
double t,vx,vy;
t=sqrt(*h/g);
vx=dis/t/;
vy=g*t;
v=vx*vx+vy*vy;
}
else{
if(y<b)
a=b/(x*x-dis*x);
else
a=t/(x*x-dis*x);
double h=a*mid*(mid-dis);
double t,vx,vy;
t=sqrt(*h/g);
vx=dis/t/;
vy=g*t;
v=vx*vx+vy*vy; }
return v;
}
double solve(double t){
double ans1=ds+t;
double ans2=df+l-t;
double v1,v2;
v1=calu(ans1,ds,b1,t1);
v2=calu(ans2,l-t,b2,t2);
return max(v1,v2);
}
int main(){
while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&b1,&t1,&b2,&t2,&l,&ds,&df,&g)!=EOF){
double low,high,mid,midd;
low=;
high=l;
while(high-low>eps){
mid=(high+low*)/;
midd=(low+high*)/;
if(solve(mid)<solve(midd))high=midd;
else low=mid;
}
printf("%.4f\n",sqrt(solve(mid)));
}
return ;
}
Little Jumper---(三分)的更多相关文章
- C - Little Jumper (三分)
题目链接:https://cn.vjudge.net/contest/281961#problem/C 题目大意:青蛙能从一个点跳到第三个点,如图,需要跳两次.问整个过程的最大起跳速度中的最小的. 具 ...
- hdu3714 三分找最值
Error Curves Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tota ...
- BZOJ 1857 传送带 (三分套三分)
在一个2维平面上有两条传送带,每一条传送带可以看成是一条线段.两条传送带分别为线段AB和线段CD.lxhgww在AB上的移动速度为P,在CD上的移动速度为Q,在平面上的移动速度R.现在lxhgww想从 ...
- hdu 4717(三分求极值)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 思路:三分时间求极小值. #include <iostream> #include ...
- HDU2438 数学+三分
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- 三分之一的程序猿之社交类app踩过的那些坑
三分之一的程序猿之社交类app踩过的那些坑 万众创新,全民创业.哪怕去年陌生人社交不管融资与否都倒闭了不知道多少家,但是依然有很多陌生人社交应用层出不穷的冒出来.各种脑洞大开,让人拍案叫起. 下面我们 ...
- 基于jPlayer的三分屏制作
三分屏,这里的三分屏只是在一个播放器里同时播放三个视频,但是要求只有一个控制面板同时控制它们,要求它们共享一个时间轨道.这次只是简单的模拟了一下功能,并没有深入的研究. 首先,需要下载jPlayer, ...
- 【BZOJ-1857】传送带 三分套三分
1857: [Scoi2010]传送带 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 1077 Solved: 575[Submit][Status][ ...
- ACM : HDU 2899 Strange fuction 解题报告 -二分、三分
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- bzoj1857: [Scoi2010]传送带--三分套三分
三分套三分模板 貌似只要是单峰函数就可以用三分求解 #include<stdio.h> #include<string.h> #include<algorithm> ...
随机推荐
- (笔记)Linux内核学习(十一)之I/O层和I/O调度机制
一 块I/O基本概念 字符设备:按照字符流的方式被有序访问的设备.如串口.键盘等. 块设备:系统中不能随机(不需要按顺序)访问固定大小的数据片(chunk 块)的设备. 如:硬盘.软盘.CD-ROM驱 ...
- 简化 Hadoop 2.4.1 Eclpse 插件编译【原创】
昨天折腾hadoop2X的eclipse插件,从https://github.com/winghc/hadoop2x-eclipse-plugin把源码搞下来后,很快搞定出来一个,但是...New H ...
- 怎样在EPLAN P8里创建自己想要的电气元件符号
1.打开Eplan P8 ,新建一个名为"新项目"的项目,然后选择菜单"工具"----"主数据"-----"符号库"-- ...
- sqlite3基础
要使用sqlite,首先需要添加库文件libsqlite3.dylib.当你搜索libsqlite3关键字时,会发现还有一个libsqlite3.0.dylib的库文件,这里还是建议添加libsqli ...
- Linux中vi显示中文乱码的问题
由于在windows下默认是gb编码,而我的vim默认是utf-8(gedit默认也是utf-8),所以打开会成乱码.修改了一下配置文件,使vi支持gb编码就好了.$vi ~/.vimrclet &a ...
- DMSFrame 之简单用法(二)
上次说了下DMSFrame的一些查询方式,之前也有好多朋友问了下这个ORM与EF有什么样的区别. 要论区别,我自己也总结了几点.如果有其它朋友知道的,可以回复补充下. 1.不需要编辑的时候需要再次查询 ...
- perl备忘
List Operators: sort reverse grep map my @castways = sort qw( first second third); # qw 给单词自动加上双引号 g ...
- 二叉树系列 - 二叉搜索树 - 线性时间内把有序链表转化为BST
引言 本文来自于Google的一道题目: how to merge two binary search tree into balanced binary search tree. how to me ...
- zk框架中利用map类型传值来创建window,并且传值
@Command @NotifyChange("accList") public void clear(@BindingParam("id") String a ...
- SNF开发平台WinForm之十二-发送手机短信功能调用-金笛-SNF快速开发平台3.3-Spring.Net.Framework
1.调用前组装参数 2.调用发送信息服务脚本 .调用前组装参数: BaseSendTaskEntity entity = new BaseSendTaskEntity(); entity.Mess ...