#C3087. Offspring DNA Equilibrium
Offspring DNA Equilibrium
Offspring DNA Equilibrium
This problem involves determining the probability that the offspring of two Trivellea plants has a DNA string with an equal number of 0s and 1s. The offspring's DNA string is generated by performing a bitwise XOR on the corresponding bits of the two parent DNA strings.
If the two parent DNA strings are of even length \(n\), the offspring's DNA string is obtained as follows:
\[ \text{DNA}_{\text{offspring}} = \text{XOR}(\text{dna1},\, \text{dna2}) \]
The probability \(P\) is defined by: \[ P = \begin{cases} 1.00000 & \text{if the number of 0s equals the number of 1s},\\ 0.00000 & \text{otherwise} \end{cases} \]
Note that if the DNA strings have an odd length, it is impossible to have an equal number of 0s and 1s, so the output should be 0.00000.
inputFormat
The input consists of two lines. The first line contains a binary string representing the DNA of the first parent plant. The second line contains a binary string representing the DNA of the second parent plant.
outputFormat
Output a single line containing the probability as a string rounded to five decimal places.## sample
101
010
0.00000