#include <iostream> using namespace std; double rate[4][4] = { {0, 0.1, 0.3, 0.5}, {0.9, 0, 0.7, 0.4}, {0.7, 0.3, 0, 0.2}, {0.5, 0.6, 0.8, 0}}; int main() { int i, j, k; double time, sum; time = 0; sum = 0; for (i = 1; i < 4; i++) { for (j = 1; j < 4; j++) { for (k = 1; k < 4; k++) { if (j != i && k != i && j != k) { sum += rate[0][i] * rate[j][k] * rate[0][j]; } } } time++; } cout << sum / time; return 0; }