A. Save Luke
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses are initially at coordinates 0 and L, and they move towards each other with speed v1 and v2, respectively. Luke has width d and is able to choose any position between the presses. Luke dies as soon as the distance between the presses is less than his width. Your task is to determine for how long Luke can stay alive.

Input

The first line of the input contains four integers d, L, v1, v2 (1 ≤ d, L, v1, v2 ≤ 10 000, d < L) — Luke's width, the initial position of the second press and the speed of the first and second presses, respectively.

Output

Print a single real value — the maximum period of time Luke can stay alive for. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

Sample test(s)
Input
2 6 2 2
Output
1.00000000000000000000
Input
1 9 1 2
Output
2.66666666666666650000
Note

In the first sample Luke should stay exactly in the middle of the segment, that is at coordinates [2;4], as the presses move with the same speed.

In the second sample he needs to occupy the position . In this case both presses move to his edges at the same time

题意:L长 两人分别从0,L点出发以速度v1,v2  当距离小于等于d时停止

#include<bits/stdc++.h>
using namespace std;
double d,l,v1,v2;
int main()
{
scanf("%lf%lf%lf%lf",&d,&l,&v1,&v2);
printf("%lf\n",(l-d)/(v1+v2));
return 0;
}

  

AIM Tech Round (Div. 2) A的更多相关文章

  1. AIM Tech Round (Div. 1) D. Birthday 数学 暴力

    D. Birthday 题目连接: http://www.codeforces.com/contest/623/problem/D Description A MIPT student named M ...

  2. AIM Tech Round (Div. 2) D. Array GCD dp

    D. Array GCD 题目连接: http://codeforces.com/contest/624/problem/D Description You are given array ai of ...

  3. AIM Tech Round (Div. 2) C. Graph and String 二分图染色

    C. Graph and String 题目连接: http://codeforces.com/contest/624/problem/C Description One day student Va ...

  4. AIM Tech Round (Div. 2) B. Making a String 贪心

    B. Making a String 题目连接: http://codeforces.com/contest/624/problem/B Description You are given an al ...

  5. AIM Tech Round (Div. 2) A. Save Luke 水题

    A. Save Luke 题目连接: http://codeforces.com/contest/624/problem/A Description Luke Skywalker got locked ...

  6. Codeforces AIM Tech Round (Div. 2)

    这是我第一次完整地参加codeforces的比赛! 成绩 news standings中第50. 我觉这个成绩不太好.我前半小时就过了前三题,但后面的两题不难,却乱搞了1.5h都没有什么结果,然后在等 ...

  7. AIM Tech Round (Div. 2) B

    B. Making a String time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  8. AIM Tech Round (Div. 1) C. Electric Charges 二分

    C. Electric Charges 题目连接: http://www.codeforces.com/contest/623/problem/C Description Programmer Sas ...

  9. AIM Tech Round (Div. 2) C. Graph and String

    C. Graph and String time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

随机推荐

  1. leetcode-分割回文子串

    给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串. 返回 s 所有可能的分割方案. 示例: 输入: "aab" 输出: [ ["aa",&quo ...

  2. 服务器返回中文乱码的情况(UTF8编码 -> 转化为 SYSTEM_LOCALE 编码)

    服务器乱码 转换使用如下方法 入惨{“msg”} -> utf8编码 -> 转化为 SYSTEM_LOCALE 编码 -> 接受转换后的参数 "sEncoding" ...

  3. Visual Stdio Code编辑Mark Down

    Visual Studio Code可以一边写Markdown一边预览了,而且不需要任何插件. 方法如下: 新建一个文件,以 .md 为后缀: Visual Studio Code 原生就支持高亮Ma ...

  4. (转载)IE8+兼容经验小结

    本文分享下我在项目中积累的IE8+兼容性问题的解决方法.根据我的实践经验,如果你在写HTML/CSS时候是按照W3C推荐的方式写的,然后下面的几点都关注过,那么基本上很大一部分IE8+兼容性问题都OK ...

  5. 11.24Daily Scrum(4)

    人员 任务分配完成情况 明天任务分配 王皓南 实现网页上视频浏览的功能.研究相关的代码和功能.1007 实现视频浏览的功能 申开亮 实现网页上视频浏览的功能.研究相关的代码和功能.1008 实现视频浏 ...

  6. win7 个人电脑 IIS7服务器(web服务器) 同一局域网下均可访问本机网页

    建立web服务器: 1.控制面板-->程序-->打开或关闭windows功能-->internet信息服务全部打钩,确定即可. 访问网页: 1.C:\inetpub\wwwroot\ ...

  7. C++计算器项目的初始部分(第三次作业)

    C++计算器项目的初始部分 项目源文件地址:calculator 项目信息: * 项目名称:Calculator * 项目实现: * 对四则运算表达式进行拆解 * 对拆解的表达式进行简单的错误判断 * ...

  8. Divide two integers without using multiplication, division and mod operator.

    描述 不能使用乘法.除法和取模(mod)等运算,除开两个数得到结果,如果内存溢出则返回Integer类型的最大值.解释一下就是:输入两个数,第一个数是被除数dividend,第二个是除数divisor ...

  9. error LNK2019: 无法解析的外部符号 该符号在函数 中被引用 解决方案

    需要添加lib或者dll库.项目-属性-配置属性-链接器-输入-附件依赖项,添加需要的lib. 例如我在运行OSG程序的时候,忘记添加了附件依赖项就会报这个错. 解决方案如图.

  10. 团队组队&灰化肥挥发会发黑

    1. 队伍展示 (1. 队名: 灰化肥挥发会发黑 (2. 队员风采 苏叶潇(队长) 201521123114 与众不同,擅长软件测试,对编程望而却步,希望成为测试人员. 宣言:不求最好,只求更好. 李 ...