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 ...
随机推荐
- topcoder srm 553
div1 250pt: 题意:... 解法:先假设空出来的位置是0,然后模拟一次看看是不是满足,如果不行的话,我们只需要关心最后栈顶的元素取值是不是受空白处的影响,于是还是模拟一下. // BEGIN ...
- Spark SQL 源代码分析之Physical Plan 到 RDD的详细实现
/** Spark SQL源代码分析系列文章*/ 接上一篇文章Spark SQL Catalyst源代码分析之Physical Plan.本文将介绍Physical Plan的toRDD的详细实现细节 ...
- 一起talk C栗子吧(第一百二十四回:C语言实例--内置宏)
各位看官们,大家好,上一回中咱们说的是显示变量和函数地址的样例,这一回咱们说的样例是:内置宏.闲话休提,言归正转.让我们一起talk C栗子吧! 看官们,我们在编译程序的时候,假设有语法错误,编译器就 ...
- Android耳机线控具体解释,蓝牙耳机button监听(仿酷狗线控效果)
转载请注明出处:http://blog.csdn.net/fengyuzhengfan/article/details/46461253 当耳机的媒体按键被单击后.Android系统会发出一个广播.该 ...
- android真机调试 INSTALL_FAILED_MEDIA_UNAVAILABLE 问题解决方案
前提是手机用数据线连到电脑,安装好手机对应的驱动. 1:打开cmd 2:cd切换到sdk安装目录的platform-tools目录,比如我安装到了D盘根目录,则输入: cd d:\android-sd ...
- Fluently NHibernate 插入CLOB字段
ORA-01461: can bind a LONG value only for insert into a LONG column 插入oracle某表时报的错. 查来查去,是插入的某个字段值超长 ...
- jupyter环境的安装
1,什么是jupyter notebook? 简介:jupyter notebook是基于网页的用户交互计算机的应用程序,其可被用于全过程计算:开发,文档编写,运行代码,和展示结果 简而言之,Jupy ...
- linux losetup
1 losetup命令的通用格式 losetup loopdev file loopdev可以看出时一个仿真设备,它本身是没有存储空间的,这个命令的作用就是将file作为它的存储空间. 一旦连接成功, ...
- 关于前端js拼接字符串的一点小经验
1.今天在做项目的时候遇到一个问题,就是使用onclick="xxx()" 点击事件的时候,参数如果为全数字就会出现点击无反应的问题.但是当参数为字符串或者动态内容的时候就会出现 ...
- 珠海鼎芯(D-Chip)IMX6读取CPU的UID的方法【转】
本文转载自:http://blog.csdn.net/williamdedong/article/details/52712084 在使用IMX6板子的时候,有时会想着是否可以把板子搞一个唯一标识呢, ...
