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. 1 2 1 2
Output
  1. 0.666666666667

Source

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

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. 使用xshell连接本地虚拟机中的Linux问题

    xshell 连接虚拟机中Linux报错: Could not connect to '192.168.8.120' (port 22):Connection failed. 原因:虚拟机中Linux ...

  2. POJ 2481 Cows【树状数组】

    题意:给出n头牛的s,e 如果有两头牛,现在si <= sj && ei >= ej 那么称牛i比牛j强壮 然后问每头牛都有几头牛比它强壮 先按照s从小到大排序,然后用e来 ...

  3. 优动漫 PAINT 导航窗口面板

    导航窗口面板用于管理画布的视图.本节将介绍如何在其中缩放.旋转.翻转画布. 如何使用导航窗口面板 使用[导航窗口]面板便于把握整个画布,以下将为您详细介绍. 什么是[导航窗口]面板 [导航窗口]面板用 ...

  4. 玩转图片上传————原生js XMLHttpRequest 结合FormData对象实现的图片上传

    var form=document.getElementById("formId"); var formData=new FormData(form); var oReq = ne ...

  5. const char *初值赋值以及文件读取

    #include<iostream> #include<fstream> #include<string> #include<cstring> usin ...

  6. 启动tomcat运行maven工程报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:

    控制台报错信息:

  7. 网页结构的简介和Xpath语法的入门教程

    相信很多小伙伴已经听说过Xpath,之前小编也写过一篇关于Xpath的文章,感兴趣的小伙伴可以戳这篇文章如何利用Xpath抓取京东网商品信息以及Python网络爬虫四大选择器(正则表达式.BS4.Xp ...

  8. P2421 [NOI2002]荒岛野人 扩展欧几里得 枚举

    Code: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ...

  9. h5 input失去焦点软键盘把页面顶起

    var broswer=localStorage.getItem('temp') //浏览器环境 var u = navigator.userAgent var isiOS = !!u.match(/ ...

  10. Fiddler常用配置

    过滤目标地址: 抓取https的设置: