Problem description

SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is  for SmallR while  for Zanoes. The one who shoots in the target first should be the winner.

Output the probability that SmallR will win the match.

Input

A single line contains four integers .

Output

Print a single real number, the probability that SmallR will win the match.

The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.

Examples

Input

1 2 1 2

Output

0.666666666667
解题思路:等比数列极限求和。推导公式如下:

AC代码:
 #include <bits/stdc++.h>
using namespace std;
int main(){
double a,b,c,d;
cin>>a>>b>>c>>d;
cout<<setiosflags(ios::fixed)<<setprecision()<<((a/b)*(/(-(-a/b)*(-c/d))))<<endl;
//printf("%.12f\n",(a/b)*(1/(1-(1-a/b)*(1-c/d))));
return ;
}

B - Archer的更多相关文章

  1. 【CodeForces 312B】BUPT 2015 newbie practice #3A Archer

    题 SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the targ ...

  2. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  3. Codeforces Round #330 (Div. 1) A. Warrior and Archer 贪心 数学

    A. Warrior and Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/594 ...

  4. archer docker安装部署

    1.准备配置文件从archer项目官网下载/archer/settings.py文件,根据自己情况放到相应的目录我下载后放到如下目录[root@lenovo opt]# mkdir -p /opt/a ...

  5. Linux~Archer 进化之路

    使用过的linux系统有:Redhat.红旗Linux.Deepin.Ubuntu.Debian.Fedora.Kali.Parrot.manjaro.Mint.Arch,最早接触linux是从200 ...

  6. 部署MySQL自动化运维工具inception+archer

    ***************************************************************************部署MySQL自动化运维工具inception+a ...

  7. centos 7 安装sql 审核工具 inception + archer

    系统环境: Centos7 + python2.7 + python3 .... 下载 源码地址:https://github.com/mysql-inception/inception Incept ...

  8. Codeforces 595C - Warrior and Archer

    595C - Warrior and Archer 思路:设最后答案的区间为[l,r],那么r-l等于n/2,因为在(l,r)中的点都是其中一个人挖掉的,[0,l)和(r,n]中的点是另一个人挖掉的, ...

  9. archer 安装

    archer 项目地址: https://github.com/jly8866/archer 安装docker版本 Pull Docker docker pull hhyo/archer 启动服务do ...

随机推荐

  1. Zookeeper开发常见问题

    背景与目的 Zookeeper开发过程中遇到一些常见问题,为了后续开发不犯同样的错误,总结一下此类问题,并进行分析和解决. 适合人员 主要适合zookeeper开发.测试及运维相关人员. 问题与解决 ...

  2. CSS多种方法实现分隔线

    <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8" /> <title&g ...

  3. notepad++ 查找引用(Find Reference)(适用于c c++及各类脚本比方lua、python等)

    在程序开发过程中,程序猿经经常使用到的一个功能就是查找引用(Find Reference).Visual Studio里面的相应功能是"查找全部引用"(Find All Refer ...

  4. EXTJS 4 树形表格组件使用演示样例

    EXTJS 4 树形表格组件使用演示样例 一.总体效果图 version=1&modificationDate=1412058826000&api=v2" alt=" ...

  5. 他人第三方库在linux上的安装

    1.下载tar.gz等压缩包 2.解压 3.安装 4.确保路径

  6. 【iOS9系列】-3DTouch开发

    [iOS9系列]-3DTouch开发 第一:简介 3DTouch 是iOS9系统系统下,在iPhone6s(iPhone6s Plus)手机上才能够使用的功能.熟练使用后,发现还是很便捷的. 但是模拟 ...

  7. GIS+=地理信息+云计算技术——Spark集群部署

    第一步:安装软件         Spark 1.5.4:wget http://www.apache.org/dyn/closer.lua/spark/spark-1.5.2/spark-1.5.2 ...

  8. SpringMVC_配置和注解--跟海涛学SpringMVC(和自己在项目中的实际使用的对比)

    Spring2.5 之前,我们都是通过实现Controller 接口或其实现来定义我们的处理器类,就像前面介绍的 这里介绍的是Spring3.1的新特性,虽然现在我用的是spring4.2.6,不过基 ...

  9. MySQL之——server保持与MySQL的连接

    转载请注明出处:http://blog.csdn.net/l1028386804/article/details/47008019 server程序常常要訪问数据库,而且server程序是长时间保持运 ...

  10. js闭包的本质

    js之所以会有闭包,是因为js不同于其他规范的语言,js允许一个函数中再嵌套子函数,正是因为这种允许函数嵌套,导致js出现了所谓闭包. function a(){ function b(){ }; b ...