关闭

CodeForces 624A Save Luke

194人阅读 评论(0) 收藏 举报
分类:
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; 
 } 


0
0
查看评论
发表评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场

lucene开发必备工具luke介绍

原文地址: 做lucene开发的,免不了要和索引文件打交道,但是一些二进制的文件我们怎么去看,下面就要隆重的有请luke了 根据百度百科的说法:Luke是一个用于Lucene搜...
  • xiaogugood
  • xiaogugood
  • 2013-07-18 10:20
  • 1752

Luke:Lucene索引查看工具

Luke介绍 Luke是一个方便的索引查看和诊断工具,可以访问Lucene构建的索引文件,显示和修改某些索引内容。能提供: 通过document编号或term浏览索引查看document内...
  • zbf8441372
  • zbf8441372
  • 2013-01-12 15:13
  • 8351

关于codeforces比赛规则介绍(转载)

Codeforces 简称: cf(所以谈论cf的时候经常被误会成TX的那款游戏). 网址: codeforces.com   这是一个俄国的算法竞赛网站,由来自萨拉托夫州立大学、由Mike Mirz...
  • y990041769
  • y990041769
  • 2014-02-19 08:41
  • 15433

CodeForces 624A Save Luke神庙大逃亡(暑期小练习)

神庙大逃亡(暑期小练习) Description LukeSkywalker got locked up in a rubbish shredder between two presses. R2D2...
  • shyazhut
  • shyazhut
  • 2016-06-01 21:05
  • 225

【CodeForces】624A - Save Luke(数学小问题)

点击打开题目 A. Save Luke time limit per test 1 second memory limit per test ...
  • wyg1997
  • wyg1997
  • 2016-06-15 07:50
  • 136

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 ...
  • Julyfandango
  • Julyfandango
  • 2016-02-06 17:41
  • 229

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

A. Save Luke time limit per test 1 second memory limit per test 256 megabytes input...
  • zugofn
  • zugofn
  • 2016-06-06 23:42
  • 177

(二) P - P Save Luke 【数学】

P - P Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Sub...
  • bmicnj
  • bmicnj
  • 2016-06-01 09:32
  • 173

Save Luke

 Save Luke Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:262144KB...
  • qq_34681949
  • qq_34681949
  • 2016-06-17 13:50
  • 108

CodeForces 624C【二分图染色】

题意: 本来有一个由’a’,’b’,’c’ 组成的字符串,然后,在这个串里,相同字符 或者 相邻字符能构成边,然后就构成了一副图。 现在抹掉了这个字符串,给你这副图,问你能不能组成这个字符串。 思...
  • KEYboarderQQ
  • KEYboarderQQ
  • 2017-07-18 20:33
  • 111
    个人资料
    • 访问:155769次
    • 积分:8295
    • 等级:
    • 排名:第2811名
    • 原创:704篇
    • 转载:2篇
    • 译文:0篇
    • 评论:19条
    最新评论