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