CF591A.Wizards' Duel

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Harry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of the corridor of length l. Two opponents simultaneously charge a deadly spell in the enemy. We know that the impulse of Harry's magic spell flies at a speed of p meters per second, and the impulse of You-Know-Who's magic spell flies at a speed of q meters per second.

The impulses are moving through the corridor toward each other, and at the time of the collision they turn round and fly back to those who cast them without changing their original speeds. Then, as soon as the impulse gets back to it's caster, the wizard reflects it and sends again towards the enemy, without changing the original speed of the impulse.

Since Harry has perfectly mastered the basics of magic, he knows that after the second collision both impulses will disappear, and a powerful explosion will occur exactly in the place of their collision. However, the young wizard isn't good at math, so he asks you to calculate the distance from his position to the place of the second meeting of the spell impulses, provided that the opponents do not change positions during the whole fight.

哈利·波特与“不可说之名”再次展开生死对决。这一次,他们分别位于一条长度为 ll 的走廊两端。两名对手同时向对方发射致命魔咒。已知哈利的魔咒脉冲以每秒 pp 米的速度飞行,而“伏地魔”的魔咒脉冲以每秒 qq 米的速度飞行。

两道脉冲在走廊中相向而行,碰撞发生时立即掉头,以各自原有的速度飞回施法者处。随后,一旦脉冲返回施法者身边,巫师便立即将其反射,再次以原有速度射向敌方。

由于哈利已完美掌握了魔法基础,他知晓:在第二次碰撞发生后,两道脉冲将同时消失,并在它们第二次相遇的位置引发一场剧烈爆炸。然而,这位年轻巫师不擅长数学,因此请你帮他计算:从哈利所处位置到两道魔咒脉冲第二次相遇地点的距离(假设双方在整个战斗过程中均不改变自身位置)。

输入格式

The first line of the input contains a single integer l (1 ≤ l ≤ 1 000) — the length of the corridor where the fight takes place.

The second line contains integer p, the third line contains integer q (1 ≤ p, q ≤ 500) — the speeds of magical impulses for Harry Potter and He-Who-Must-Not-Be-Named, respectively.

输入的第一行包含一个整数 ll(1≤l≤1 0001 \leq l \leq 1\,000)—— 表示战斗发生的走廊长度。

第二行包含整数 pp,第三行包含整数 qq(1≤p, q≤5001 \leq p,\, q \leq 500)—— 分别表示哈利·波特与伏地魔所释放的魔法脉冲的速度。

输出格式

Print a single real number — the distance from the end of the corridor, where Harry is located, to the place of the second meeting of the spell impulses. Your answer will be considered correct if its absolute or relative error will not exceed 10 - 4.

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

输出一个实数——即从走廊末端(哈利所在位置)到咒语脉冲第二次相遇位置的距离。若你的答案的绝对误差或相对误差不超过 10−410^{-4},则视为正确。

具体而言:假设你的答案为 aa,而裁判组的答案为 bb。当满足 时,校验程序将判定你的答案正确。

输入输出样例

  • 输入#1

    100
    50
    50

    输出#1

    50
  • 输入#2

    199
    60
    40

    输出#2

    119.4

说明/提示

In the first sample the speeds of the impulses are equal, so both of their meetings occur exactly in the middle of the corridor.

在第一个样例中,两个脉冲的速度相等,因此它们的两次相遇都恰好发生在走廊的正中间。

输入解题思路,AI测评打分。不知道怎么写?

首页