Codeforces Round #327 (Div. 2) A. Wizards' Duel 水题
2015-10-26 08:39
411 查看
A. Wizards' Duel
Time Limit: 20 SecMemory Limit: 256 MB
题目连接
http://codeforces.com/contest/591/problem/ADescription
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.
[b]Input[/b]
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.
[b]Output[/b]
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
.
[b]Sample Input[/b]
100
50
50
[b]Sample Output[/b]
50
HINT
[b]题意[/b]
在长度为l的跑道上,左边人的速度是a,右边人的速度是b,然后问你相遇在哪儿
[b]题解:[/b]
物理题啦,先算出相遇时间,然后a*t就好了
[b]代码[/b]
#include<iostream> #include<stdio.h> using namespace std; int main() { double a,b,c; cin>>a>>b>>c; double t = a/(b+c); printf("%.12lf\n",t*b); }
相关文章推荐
- JSP userBean setProperty直接从request中获取参数
- Android 高级UI设计笔记06:仿微信图片选择器
- 10.14~10.25刷题(shui)记录
- UI基础篇-------UITabBarController的使用
- LeetCode_N-Queens II
- LeetCode_N-Queens
- requestWindowFeature()的应用
- Codeforces Round #327 (Div. 2)A. Wizards' Duel
- UIScrollView的常见属性
- SqlCommandBuilder如何实现批量更新
- 禁止UITextField 使用粘贴复制功能
- Gson之实例二-Gson注解和GsonBuilder
- iOS开发uibutton设置圆角形状
- 从头认识java-3.2 return break continue
- UUID的获取一句话
- request.getServletPath() 和 request.getPathInfo()
- Failed to read auto-increment value from storage
- 修改KVM虚机镜像中的文件的几种方法(Guestfish/Guestmount /virt-*tools)
- HDU 4675 GCD of Sequence (莫比乌斯反演)
- 使用UUID方法生成全球唯一标识