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. 《汇编语言(第三版)》cmp指令

    # cmp指令 本质 cmp是比较指令,cmp的功能相当于减法. 格式 cmp 操作对象1,操作对象2 功能 计算操作对象1-操作对象2,但并不保存结果,可以根据flag标志寄存器来判断结果. 正向判 ...

  2. Jquery 设置class 和 div CSS

    Jquery 设置class 和 div CSS 1 Jquery 根据标签内容获取标签div,从而修改该div CLASS //追加 $('label:contains("labelcon ...

  3. 一个渣渣python脚本,用wol控制开机

    #!/usr/bin/env python #coding:utf8 import os,time d={} '''f = open('E:\info.txt','r') for ipmac in f ...

  4. 关于PY的推导式

    列表推导式: In [26]: [i*2 for i in range(10)] Out[26]: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18] 字典推导式: In [29] ...

  5. SASS 使用(vs code)

    二.在vs code中编译sass 1.在拓展商店里搜索“easy sass”,并安装,安装成功后点重新加载. 2.接下来进行配置: 在 vs code 菜单栏依次点击“文件 首选项 设置”,打开 s ...

  6. 计数排序(counting-sort)

    计数排序是一种稳定的排序算法,它不是比较排序.计数排序是有条件限制的:排序的数必须是n个0到k的数,所以计数排序不适合给字母排序.计数排序时间复杂度:O(n+k),空间复杂度:O(k),当k=n时,时 ...

  7. 将页面的内容导出使用html2canvas+jsPDF

    第一首先是要引用 import jsPDF from 'jspdf' import html2canvas from 'html2canvas' import PDFJS from 'pdfjs-di ...

  8. HDU——T 1150 Machine Schedule

    http://acm.hdu.edu.cn/showproblem.php?pid=1150 Time Limit: 2000/1000 MS (Java/Others)    Memory Limi ...

  9. 基于Core Text实现的TXT电子书阅读器

    本篇文章的项目地址基于Core Text实现的TXT电子书阅读器. 最近花了一点时间学习了iOS的底层文字处理的框架Core Text.在网上也参考很多资料,具体的资料在文章最后列了出来,有兴趣的可参 ...

  10. android中的AlertDialog具体概述

    android的AlertDialog具体解释 AlertDialog的构造方法所有是Protected的.所以不能直接通过new一个AlertDialog来创建出一个AlertDialog. 要创建 ...