题目链接:

http://codeforces.com/problemset/problem/591/A

题意:

a,b两个相距L距离,两个分别以p,q速度从左右两个端点出发,每次相遇后,又以原来的速度返回,问第二次相遇后的地点在哪?

解题思路:

其实这个题目,每一次相遇的地点都是一模一样的,也就是第一次相遇的地点;

设他们t时间相遇,则a*t+b*t=L

则相遇地点应为a的速度p,乘a与b相遇所花的时间t,即相遇地点=p*L/(a+b)。

程序代码:

#include <cstdio>
using namespace std; int main()
{
int l,p,q;
while(scanf("%d%d%d",&l,&p,&q)==)
{
printf("%.4f\n",l*p*1.0/(q+p));
}
return ;
}

CodeForces 591A的更多相关文章

  1. codeforces 591A. Wizards' Duel 解题报告

    题目链接:http://codeforces.com/problemset/problem/591/A 题目意思:其实看下面这幅图就知道题意了,就是Harry 和 He-Who-Must-Not-Be ...

  2. CodeForces 591A Wizards' Duel

    水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...

  3. Codeforces Round #327 (Div2) A~E

    CodeForces 591A 题意:在距离为L的两端A,B,相向发射魔法,a(以P1的速度)-->B,A<--b(以P2的速度).假设a-->B,途中相遇,则返回到原点A<- ...

  4. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  5. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  6. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  7. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  8. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  9. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

随机推荐

  1. require.js优化器

    项目发布前,require.js优化器可以合并require.js各个模块. 官网: http://requirejs.org/docs/optimization.html 安装 npm instal ...

  2. js substr和substring字符串截取

    substr(start,length)第一个参数是开始位置(注:start的开始是从0开始,看到好多博客上面是从1开始,在火狐和谷歌执行了一下是从0开始),第二个参数是截取字符串的长度(可以省略,表 ...

  3. JS根据key值获取URL中的参数值,以及把URL的参数转换成json对象

    //把url的参数部分转化成json对象 parseQueryString: function (url) { var reg_url = /^[^\?]+\?([\w\W]+)$/, reg_par ...

  4. 实训第一天--增删改查加hibernate+搭建环境常见问题

    1.     搭建环境 安装 1)谷歌浏览器 2)jdk-7u67-windows-i586.exe 3)Tomcat7 4)NavicatforMySQL 两种方式: ftp://172.21.95 ...

  5. Nginx配置http强制跳转到https

    目的:访问http://sdk.open.test.com/时强制自动跳转到https://sdk.open.test.com/ 修改nginx站点配置文件sdk.open.test.com.conf ...

  6. ajax 操作全局监测,用户session失效

    jQuery(function ($) { // 备份jquery的ajax方法 var _ajax = $.ajax; // 重写ajax方法,先判断登录在执行success函数 $.ajax = ...

  7. &nbsp; 与 空格的区别

    nbsp 是 Non-Breaking SPace的缩写,即“不被折断的空格”,当两个单词使用   连接时,这两个单词就不会被分隔为2行,如下面 <div id="div1" ...

  8. Wdcp两日志的路径

    Wdcp两日志的路径: /www/wdlinux/httpd-2.2.22/logs /www/wdlinux/nginx-1.0.15/logs

  9. Android中AppWidget的分析与应用:AppWidgetProvider .

    from: http://blog.csdn.net/thl789/article/details/7887968 本文从开发AppWidgetProvider角度出发,看一个AppWidgetPrv ...

  10. BAE 环境下 hibernate annotations 配置

     annotations 配置 首先需要加入 hibernate-jpa-2.0-api-1.0.1.Final.jar 和 ejb3-persistence.jar 这两个包 ejb3-persis ...