nullnullCF 312B(Archer等比数列极限求和)

本篇文章个人在北京逛街的时候突然想到的...这几周就有想写几篇关于nullnull的博客,所以回家到之后就奋笔疾书的写出来发表了

B. Archer
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 null和null for SmallR while null和null 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 null和null.

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 test(s)
input
1 2 1 2
output
0.666666666667

    每日一道理
“上下五千年,龙的看火不灭;古有愚公志,而今从头越…… ”站在新世纪的门槛上,我们的追求就是让祖国灿烂的喜悦飞扬在美好的明天……

等比数列无限乞降公式 a+ap+ap^2+...    0<p<1   -->     S=a/(1-p)

    

    

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<cctype>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define RepD(i,n) for(int i=n;i>=0;i--)
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	double a,b,c,d;
	cin>>a>>b>>c>>d;
	printf("%.12lf\n",a/b/(1-(1-a/b)*(1-c/d)));
	
	return 0;
}

文章结束给大家分享下程序员的一些笑话语录: 据说有一位软件工程师,一位硬件工程师和一位项目经理同坐车参加研讨会。不幸在从盘山公路下山时坏在半路上了。于是两位工程师和一位经理就如何修车的问题展开了讨论。
硬件工程师说:“我可以用随身携带的瑞士军刀把车坏的部分拆下来,找出原因,排除故障。”
项目经理说:“根据经营管理学,应该召开会议,根据问题现状写出需求报告,制订计划,编写日程安排,逐步逼近,alpha测试,beta1测试和beta2测试解决问题。”
软件工程说:“咱们还是应该把车推回山顶再开下来,看看问题是否重复发生。”

--------------------------------- 原创文章 By
null和null
---------------------------------

原文地址:https://www.cnblogs.com/xinyuyuanm/p/3102393.html