B - Archer
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的更多相关文章
- 【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 ...
- 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 ...
- 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 ...
- archer docker安装部署
1.准备配置文件从archer项目官网下载/archer/settings.py文件,根据自己情况放到相应的目录我下载后放到如下目录[root@lenovo opt]# mkdir -p /opt/a ...
- Linux~Archer 进化之路
使用过的linux系统有:Redhat.红旗Linux.Deepin.Ubuntu.Debian.Fedora.Kali.Parrot.manjaro.Mint.Arch,最早接触linux是从200 ...
- 部署MySQL自动化运维工具inception+archer
***************************************************************************部署MySQL自动化运维工具inception+a ...
- centos 7 安装sql 审核工具 inception + archer
系统环境: Centos7 + python2.7 + python3 .... 下载 源码地址:https://github.com/mysql-inception/inception Incept ...
- Codeforces 595C - Warrior and Archer
595C - Warrior and Archer 思路:设最后答案的区间为[l,r],那么r-l等于n/2,因为在(l,r)中的点都是其中一个人挖掉的,[0,l)和(r,n]中的点是另一个人挖掉的, ...
- archer 安装
archer 项目地址: https://github.com/jly8866/archer 安装docker版本 Pull Docker docker pull hhyo/archer 启动服务do ...
随机推荐
- NoSQL之Memcached
一.Memcached概念 Memcached是NoSQL产品之中的一个,是一个暂时性键值存储NoSQL数据库,过去被大量使用在互联网站点中,作为应用和数据库之间的缓存层,大大提高查询和訪问速度. M ...
- 创立一个站点的前前后后(起因,域名,云平台,备案,CDN等等)(1)
起因 写完<完美软件开发:方法与逻辑>这书后,原本想继续写书的,可出来參加了些社区活动后,我发现我写的书大家评价还行.但事实上不太理解.而接下来想写的书更加抽象点.准备叫<管理的解析 ...
- Eclipse导入项目: No projects are found to import
Eclipse导入项目: No projects are found to import 如果发导入工程import的时候,出现”No projects are found to import” 的 ...
- 理解Paxos Made Practical
Paxos Made Practical 当一个组中一台机器提出一个值时,其它成员机器通过PAXOS算法在这个值上达成一致. Paxos分三个阶段. 第一阶段: 提出者会选出一个提议编号n(n> ...
- Mac下Git项目使用的.gitignore文件
https://www.gitignore.io/ 这个网站可以搜索特定项目.系统所需要的.gitignore 我现在主要是在Mac上用Visual Studio Code进行开发,所以直接搜索Mac ...
- HDU 5302(Connect the Graph- 构造)
Connect the Graph Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- 2015/12/25 ① 图灵测试 ② 安装jdk出现的问题 ③ 配置环境变量
①图灵测试 1,解释 图灵测试一词来源于计算机科学和密码学的先驱阿兰·麦席森·图灵写于1950年的一篇论文<计算机器与智能>.阿兰·麦席森·图灵1950年设计出这个测试,其内容是,如果电脑 ...
- SpringMVC_基本配置 --跟海涛学SpringMVC(和自己在项目中的实际使用的对比)
☆依赖jar包: 1.Spring框架jar 包: 为了简单,将spring-framework-3.1.1.RELEASE-with-docs.zip/dist/下的所有jar包拷贝到项目的WEB- ...
- C 项目案例实践(1)数据结构之链表(0)
链表是通过一组任意的存储单元来存储线性表中的数据元素的,那么怎样表示出数据元素之间的线性关系呢?为建立数据元素之间的线性关系,对每个数据元素ai,除了存放数据元素的自身信息ai之外,还需要存放和ai一 ...
- tcp state
[root@hadoop1 log]# netstatActive Internet connections (w/o servers)Proto Recv-Q Send-Q Local Addres ...
