B. Archer
来源:互联网 发布:五子棋游戏c语言代码 编辑:程序博客网 时间:2024/04/29 06:02
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputSmallR 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 test(s)
input
1 2 1 2
output
0.666666666667
解题说明:此题是一道概率题,只需要每一轮射击以后前一个人的概率大于第二个人即可
#include <iostream>#include<algorithm>#include<cstdio>#include<cmath>#include<cstring>#include<cstdlib>using namespace std;int main(){int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);printf("%.10f",(float)(a*d)/(a*d+b*c-a*c));return 0;}
- B. Archer
- CodeForces 312B--Archer
- Archer 【CF--312B】
- CodeForces 312B Archer
- codeforces-312B Archer
- Archer
- 发布 Archer B-Ware 0.3.0 Standard
- CF 312B(Archer-等比数列极限求和)
- Archer是什么?
- 在 xone.org.cn 上的 Archer
- Archer and Mage Guides in Fiesta Online
- CF 78D Archer's Shot题解
- Codeforces 594A - Warrior and Archer (思维)
- codeforces 595C Warrior and Archer(博弈)
- 【线性筛法求解积性函数】Archer
- Codeforces Round #330 (Div. 1) A. Warrior and Archer
- 北邮OJ 1027. 16校赛-Archer in Archery
- Codeforces Round #330 (Div. 2)C. Warrior and Archer
- C#入门经典—第三章
- 通向架构师的道路(第二十一天)万能框架spring(三)之SSH
- win32程序 注册窗口类
- Android Handler+ExecutorService(线程池)+MessageQueue模式+缓存模式
- ort_workstealing.c
- B. Archer
- 黑马程序员----面向对象3
- 通向架构师的道路(第二十二天)万能框架spring(四)使用struts2
- eclipse 内存不足OutOfMemoryError设置
- 自学日语第一天,第一课。
- 通向架构师的道路(第二十三天)maven与ant的奇妙整合
- jQuery选择器-WEB自动化测试提速之利剑
- 求两个已序数组的中位数
- fatal error C1189错误