CodeForces 624A Save Luke

原创 2016年05月30日 13:08:05
P - P
Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Description

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 0and 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 dLv1v2 (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 Input

Input
2 6 2 2
Output
1.00000000000000000000
Input
1 9 1 2
Output
2.66666666666666650000

Hint

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 ,相对而行。速度分别为v1,v2,当它们之间的距离大于d时安全,问安全的时间。

小学生的数学题目。。

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	double d,l,v1,v2;
	while(scanf("%lf%lf%lf%lf",&d,&l,&v1,&v2)!=EOF)
	{
		l=l-d;
		printf("%.20lf\n",l/(v1+v2));
	 }
	 return 0; 
 } 


版权声明:本文为博主原创文章,转载请注明出处。

相关文章推荐

Codeforces AIM Tech Round (Div. 2) 624A A. Save Luke

A. Save Luke time limit per test1 second memory limit per test256 megabytes inputstandard input ...

Codeforces 653A: Save Luke(简单物理题)

A. Save Luke time limit per test 1 second memory limit per test 256 megabytes input...

Save Luke

 Save Luke Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB...

CodeForces 624C【二分图染色】

题意: 本来有一个由’a’,’b’,’c’ 组成的字符串,然后,在这个串里,相同字符 或者 相邻字符能构成边,然后就构成了一副图。 现在抹掉了这个字符串,给你这副图,问你能不能组成这个字符串。 思...

CodeForces 624D Array GCD

传送门:http://codeforces.com/problemset/problem/624/D 题目大意:给一个序列,有两种操作 1,删掉某一个连续区间,代价为区间长度*a 2,把...

codeforces624B Making a String 贪心 排序

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

使用Tika、Luke工具解析多种类型(word、pdf、txt 等)索引文件

Tika 是2008年才产生的apache的一个项目,主要用于打开各种不同类型的文档,获取其文本信息。可以解析多种类型(word、pdf、txt 、html等)文件! 甚至可以通过解析url,获取其网...

Codeforces 题库 201-294

  • 2013-04-11 10:40
  • 4.13MB
  • 下载

Luke:Lucene索引查看工具

Luke介绍 Luke是一个方便的索引查看和诊断工具,可以访问Lucene构建的索引文件,显示和修改某些索引内容。能提供: 通过document编号或term浏览索引查看document内...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)