Codeforces Round #327 (Div. 2) A. Wizards' Duel 水题
A. Wizards' Duel
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/contest/591/problem/A
Description
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.
Input
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.
Output
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 .
Sample Input
100
50
50
Sample Output
50
HINT
题意
在长度为l的跑道上,左边人的速度是a,右边人的速度是b,然后问你相遇在哪儿
题解:
物理题啦,先算出相遇时间,然后a*t就好了
代码
#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);
}
Codeforces Round #327 (Div. 2) A. Wizards' Duel 水题的更多相关文章
- Codeforces Round #367 (Div. 2) A. Beru-taxi (水题)
Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b ...
- Codeforces Round #334 (Div. 2) A. Uncowed Forces 水题
A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/pro ...
- Codeforces Round #353 (Div. 2) A. Infinite Sequence 水题
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/675/problem/A Description Vasya likes e ...
- Codeforces Round #146 (Div. 1) A. LCM Challenge 水题
A. LCM Challenge 题目连接: http://www.codeforces.com/contest/235/problem/A Description Some days ago, I ...
- Codeforces Round #335 (Div. 2) B. Testing Robots 水题
B. Testing Robots Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606 ...
- Codeforces Round #335 (Div. 2) A. Magic Spheres 水题
A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...
- Codeforces Round #306 (Div. 2) A. Two Substrings 水题
A. Two Substrings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/pro ...
- Codeforces Round #188 (Div. 2) A. Even Odds 水题
A. Even Odds Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/problem/ ...
- Codeforces Round #333 (Div. 2) A. Two Bases 水题
A. Two Bases Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/602/problem/ ...
随机推荐
- hdu 4300(kmp)
题意:说实话这个题的题意还真的挺难懂的,我开始看了好久都没看懂,后来百度了下题意才弄懂了,这题的意思就是首先有一个字母的转换表,就是输入的第一行的字符串,就是'a'转成第一个字母,'b'转成转换表的第 ...
- 1045 整数礼物 c语言
描述 Na 给准备送给ZZ两个整数,a, b,他还计算了这两个整数的平均值c,碰巧c也是整数. 但是Na 突然把b给弄丢了,你要帮助Na通过a, c计算出来b的值. 输入 输入为一行,两个用空格隔开的 ...
- alibaba笔试
1.D A(7,7)/(A(3,3)A(2,2)) = 420 关联: 字符串的排列和组合:http://blog.csdn.net/hackbuteer1/article/details/7462 ...
- switchomega配置
- bzoj 1537 [POI2005]Aut- The Bus(DP+BIT)
[题意] 顺序经过k个点,求获得的最大权值和. [思路] 设f[i]表示到第i个点,则有转移式: f[i]=min{ f[j]+w[i] } x[j]<=x[i],y[j]<=y[i] 满 ...
- 定位程序问题的方法 -- clwu
原本的标题的<定位程序代码的方法>,但问题有时候超出了自己代码的范围,而是别人的程序,所以今天想分享的是一个通用的分析问题(程序)的思路. 先来说一下在使用别人的程序(Vim)过程中遇到问 ...
- Android JNI之JAVA与C++对象建立对称关联(JNI优化设计,确保JNI调用的稳定性)
转载请声明:原文转自:http://www.cnblogs.com/xiezie/p/5930503.html Android JNI之JAVA与C++对象建立对称关联 1.JAVA对象持有C++对象 ...
- 《Java数据结构与算法》笔记-CH2有序数组
/** * 上个例子是无序数组,并且没有考虑重复元素的情况. * 下面来设计一个有序数组,我们设定不允许重复,这样提高查找的速度,但是降低了插入操作的速度. * 1.线性查找 * 2.二分查找 * 有 ...
- 【bz2594】水管局长数据加强版
题意: 给出一张n节点.m条代权无向边的无向联通图 和q个任务 1:询问一条x到y的路径 并使路径上最大权值最小 要求输出路径上最大权值 2:宣布x到y的路径报废题目保证该图永远联通 题解: 这是道凶 ...
- redis高级实用特性
1. 安全性 2. 主从复制 3. 事务处理 4. 持久化机制 5. 发布订阅消息 : 可以做一个消息系统 6. 虚拟内存的使用 一 . 安全性 设置客户端连接后进行任何其他指定前需要使用的密码 . ...