Codeforces 312B Archer

Source: Internet
Author: User

Archertime limit:2000msmemory limit:262144kbthis problem'll be judged onCodeforces. 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 is SMALLR and for zanoes. The one who shoots in the target first should is the winner.

Output the probability that Smallr would win the match.

Input

A single line contains four integers.

Output

Print a single real number, the probability that Smallr would win the match.

The answer would be considered correct if the absolute or relative error doesn ' t exceed -6.

Sample InputInput
1 2 1 2
Output
0.666666666667
SourceCodeforces Round #185 (Div. 2) Problem solving: The limit of geometric series summation
1#include <bits/stdc++.h>2 using namespacestd;3 inta,b,c,d;4 intMain () {5      while(~SCANF ("%d%d%d%d",&a,&b,&c,&d))6printf"%.8f\n",(Double) a*d/(a*d+b*c-c*a));7     return 0;8}
View Code

Codeforces 312B Archer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.