303034: CF591A. Wizards' Duel

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Wizards' Duel

题意翻译

# 题目描述 哈利波特与伏地魔再次进行了斗争。这次他们所在的地点是一个长度为 l 的走廊的两端。两个人同时向对方发射了一个致命的咒语。我们现在知道哈利的咒语的脉冲速度为 p 米每秒,而伏地魔的咒语速度 q 米每秒。 两个咒语正穿越走廊,冲向对方。在碰撞的那一刻,它们以原速掉头朝发射它们的人飞去。之后,一旦它冲回它的发射者,那个巫师就会将它以原速反弹回去。 因为哈利已经完全掌握了魔法的基础知识,他知道在两个咒语第二次碰撞时,两个咒语都会消失,并且会有一个强有力的爆炸在那儿发生。但是,小巫师并不擅长数学,因此他请求你帮他计算从他的位置到两个咒语第二次碰撞位置的距离。假设两个对手在整个战斗过程中没有改变位置。 # 输入格式 第一行输入一个整数 l (1<=l<=1000 )-----走廊长度 第二行输入正整数 p ,第三行输入正整数 q -----分别代表哈利波特与伏地魔施展的魔法的飞行速度。 # 输出格式 输出一个正数-----从哈利波特的位置到两个咒语第二次碰撞位置的距离。

题目描述

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.

输入输出格式

输入格式


The first line of the input contains a single integer $ l $ ( $ 1<=l<=1000 $ ) — 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.

输出格式


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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF591A/52c84cb27b50fce8b08f35fa39c1f083ebd1a014.png).

输入输出样例

输入样例 #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.

Input

题意翻译

# 题目描述 哈利波特与伏地魔再次进行了斗争。这次他们所在的地点是一个长度为 l 的走廊的两端。两个人同时向对方发射了一个致命的咒语。我们现在知道哈利的咒语的脉冲速度为 p 米每秒,而伏地魔的咒语速度 q 米每秒。 两个咒语正穿越走廊,冲向对方。在碰撞的那一刻,它们以原速掉头朝发射它们的人飞去。之后,一旦它冲回它的发射者,那个巫师就会将它以原速反弹回去。 因为哈利已经完全掌握了魔法的基础知识,他知道在两个咒语第二次碰撞时,两个咒语都会消失,并且会有一个强有力的爆炸在那儿发生。但是,小巫师并不擅长数学,因此他请求你帮他计算从他的位置到两个咒语第二次碰撞位置的距离。假设两个对手在整个战斗过程中没有改变位置。 # 输入格式 第一行输入一个整数 l (1<=l<=1000 )-----走廊长度 第二行输入正整数 p ,第三行输入正整数 q -----分别代表哈利波特与伏地魔施展的魔法的飞行速度。 # 输出格式 输出一个正数-----从哈利波特的位置到两个咒语第二次碰撞位置的距离。

加入题单

上一题 下一题 算法标签: