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> ...
随机推荐
- js实现表单序列化的两种方法。
function serialize(form) { var parts = [], elems = form.elements, i = , len = elems.length, filed = ...
- BZOJ 1006 [HNOI2008] 神奇的国度(简单弦图的染色)
题目大意 K 国是一个热衷三角形的国度,连人的交往也只喜欢三角原则.他们认为三角关系:即 AB 相互认识,BC 相互认识,CA 相互认识,是简洁高效的.为了巩固三角关系,K 国禁止四边关系,五边关系等 ...
- ping: sendto: Network is unreachable
在我的板子上ping路由上的IP的时候可以ping通,但是ping外网的IP的时候提示"ping: sendto: Network is unreachable" 后来使用rout ...
- adb permission denied
1.没有得到root权限,可以用刷机精灵一键root. 2.root不彻底,手机安装超级adbd,即可.
- 【转】How to resolve ORA-19706 error when select from dblink
文章转自:http://www.dbform.com/html/2012/1846.html
- JS获取跨域的cookie实例
如果说JS能实现跨域cookie,你可能觉得不太可能实现,不过事实上,这个还是可以搞定的,不过需要一定的条件才行的哦!具体方案如下: 一共需要3个文件,第一个文件为需要获取cookie的页面,在这个页 ...
- 不使用ajax,无刷新提交表单
<form action="form_action.asp" method="get" onsubmit"check_form()" ...
- 【NS2仿真】TCP协议
# # ftp # \ # tcp sink # \ / # n0--------5M 2ms---------n1 # # set ns [new Simulator] set f [open ou ...
- imagepng或imagejpeg浏览器无显示问题
可以先参考这篇文章,检查一下php的文件编码是否有bom 然而我并不是这个问题,后来想到或许是输出缓冲中有其它内容, 于是尝试 ob_clean();$imagepng($im);或//imagejp ...
- 重识JavaScript 之 数据类型的相互转换
字符串转换数字 var a = '1'; console.log(+a); console.log(a++); console.log(-a+3); console.log(parseInt(a)); ...