码迷,mamicode.com
首页 > 其他好文 > 详细

CodeForces 312B Archer

时间:2015-07-19 21:31:07      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

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

 
解题:等比数列求和的极限
 
技术分享
1 #include <bits/stdc++.h>
2 using namespace std;
3 int a,b,c,d;
4 int main(){
5     while(~scanf("%d%d%d%d",&a,&b,&c,&d))
6         printf("%.8f\n",(double)a*d/(a*d+b*c-c*a));
7     return 0;
8 }
View Code

 

CodeForces 312B Archer

标签:

原文地址:http://www.cnblogs.com/crackpotisback/p/4659402.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!