Archer

Time Limit: 2000ms
Memory Limit: 262144KB

This problem will be judged on CodeForces. Original ID: 312B
64-bit integer IO format: %I64d      Java class name: (Any)

 
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.

 

Sample Input

Input
1 2 1 2
Output
0.666666666667

Source

 
解题:等比数列求和的极限
 
 #include <bits/stdc++.h>
using namespace std;
int a,b,c,d;
int main(){
while(~scanf("%d%d%d%d",&a,&b,&c,&d))
printf("%.8f\n",(double)a*d/(a*d+b*c-c*a));
return ;
}

CodeForces 312B 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 78D Archer's Shot

    二分. 统计过程如下图: 先统计红线上的个数,然后统计绿线上的个数,然后统计咖啡色线上的个数......一个一个往下统计就可以了. #pragma comment(linker, "/STA ...

  3. 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 ...

  4. 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 ...

  5. Codeforces 595C - Warrior and Archer

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

  6. Codeforces 594A - Warrior and Archer

    题目大意:给你在一条线上的n(偶数)个点,mike和alice 开始禁点,他们轮流开始,直到最后只剩下两个点, mike希望剩下的两个点距离尽可能小,alice希望剩下的两个点距离尽可能大,他们都采用 ...

  7. 【Codeforces Round #185 (Div. 2) B】Archer

    [链接] 链接 [题意] 在这里输入题意 [题解] 概率水题. 枚举它是第几轮成功的. 直到满足精度就好 [错的次数] 1 [反思] long double最让人安心. [代码] #include & ...

  8. Codeforces Beta Round #6 (Div. 2 Only) D. Lizards and Basements 2 dp

    题目链接: http://codeforces.com/problemset/problem/6/D D. Lizards and Basements 2 time limit per test2 s ...

  9. Codeforces Beta Round #6 (Div. 2 Only) D. Lizards and Basements 2 dfs

    D. Lizards and Basements 2 题目连接: http://codeforces.com/contest/6/problem/D Description This is simpl ...

随机推荐

  1. vmware workstation pro 14 虚拟机无法开启、黑屏的解决方案汇总

    方案1:卸载鲁大师,重启. 方案2:管理员命令行,输入netsh winsock reset,重启. 方案3:360安全管家修复LSP,重启. 方案4:卸载14.0,安装12.0,手动导入虚拟机.

  2. Java文件(io)编程——文件字节流的使用

    案例1: 演示FileInputStream类的使用(用FileInputStream的对象把文件读入到内存) 首先要在E盘新建一个文本文件,命名为test.txt,输入若干字符 public cla ...

  3. python面向对象的成员、属性等

    #类成员: #字段 self.xy =qq . xy=qq #普通字段 (保存在对象里面) #直接通过点(.)+ 字段 进行调用 #静态字段 (保存在类里面) #静态字段属于类,在内存只保留一份 . ...

  4. php计算两个日期相差的天数

    /** * 时间差计算 * * @param Timestamp $time * @return String Time Elapsed */ function time2Units ($time,$ ...

  5. CentOS7-1810 系统DNS服务器BIND软件配置说明

    DNS的出现的历史 网络出现的早期是使用IP地址通讯的,那时就几台主机通讯.但是随着接入网络主机的增多,这种数字标识的地址非常不便于记忆,UNIX上就出现了建立一个叫做hosts的文件(Linux和W ...

  6. BZOJ 3325 [SCOI2013]密码 (逆模拟Manacher+构造)

    题目大意:给你一个字符串每个位置和相邻两个位置为回文中心的最长回文串长度,让你构造一个合法的字典序最小的字符串 挺有意思的构造题 首先按照$Manacher$的思想还原$p$数组 定义$f_{ij}$ ...

  7. 越努力越幸运--动态数组vector

    最近回忆山哥写的stl,觉得很好用,也写了一份. 感谢群里的大佬帮忙review,还是很多的问题的. code:https://github.com/HellsingAshen/vector_c.gi ...

  8. cobbler Ubuntu16.04 安装

    cobbler vim /etc/debmirror.conf      sed -i 's/@dists=\"sid\";/#@dists=\"sid\";/ ...

  9. linux下安装jdk跟tomcat

    文章参考    https://www.cnblogs.com/geekdc/p/5607100.html   Linux服务器安装jdk+tomcat https://baijiahao.baidu ...

  10. 用shell写一个简单DHCP配置脚本

    轩轩写的这个小脚本,主要是可以进行对dhcp服务的安装.简单配置.开启.关闭/查看状态等情况 使用呢非常简单,按照步骤进行准确的设置就可以啦 #!/bin/bashyum -y install dhc ...