Description: equivalent to a tree. Considering all the situations, DP # include <cstdio> # include <cmath> char s [18] [15]; double DP [20] [6], num [18] [18]; int main () {// freopen ("in.txt", "r", stdin); int N, P, Q; for (INT I = 0; I <16; ++ I) scanf ("% s", s [I]); For (INT I = 0; I <16; ++ I) for (Int J = 0; j <16; ++ J) {scanf ("% d", & N ); num [I] [J] = N/100.0;} For (INT I = 0; I <16; ++ I) {if (I % 2 = 0) P = I + 1; else P = I-1; DP [I] [1] = num [I] [p];} For (INT I = 2; I <= 4; ++ I) for (Int J = 0; j <16; ++ J) {P = (INT) (POW (2.0, I) + 0.5 ); Q = (J/P) * P; If (J % P <p/2) for (int K = p/2 + q; k <q + P; + + k) DP [J] [I] + = num [J] [k] * DP [k] [I-1]; else for (int K = Q; k <q + p/2; ++ K) DP [J] [I] + = num [J] [k] * DP [k] [I-1]; DP [J] [I] * = DP [J] [I-1];} For (INT I = 0; I <16; ++ I) printf ("%-10 s p = %. 2lf % s \ n ", s [I], DP [I] [4] * 100," % "); Return 0 ;}