csp-s91 T2 Cicada and Sequencing

Dp decadent to the normal version of the definition and explanation of yzh

Consider the issue of random selection between a portion that the same number, the required part of the final position

Due to the overall complexity and n considering a relatively small number of considerations for each run to merge, provided g [i] [j] denotes the probability of the left and right hands, respectively, i, j is

Then the probability of occurrence of a situation that would put the number and which can also be learned

F array and then set to a seek answers, f [i] [j] denotes the probability for the number of partition number of the currently processed node i on the j

To the push-start f [k] [pos] = 1; then f [k] [i-1 + j-mid] [j] = f [k << 1] [i] * g [i] [j] * fir + f [k << 1 | 1] [j] * g [i] [j] * sec;

fir and sec determined by the result of the comparison is 1 or 0 or 0.5.

 

The probability of occurrence of the situation finalized

Consider a situation fixing do in complex situations

Do not memset, f array is large and with or without memory.

Guess you like

Origin www.cnblogs.com/three-D/p/11775846.html