#include #include using namespace std; #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i> A >> B >> C >> N; dp[A][B][C] = 1; for (int i = 0; i < N; i++) FOR(a, 1, A + 1) FOR(b, 1, B + 1) FOR(c, 1, C + 1) { double n = a + b + c; double paa = a * (a - 1) / (n * (n - 1)); double pbb = b * (b - 1) / (n * (n - 1)); double pcc = c * (c - 1) / (n * (n - 1)); double p0 = 1 - paa - pbb - pcc; ret[0] += dp[a][b][c] * paa; ret[1] += dp[a][b][c] * pbb; ret[2] += dp[a][b][c] * pcc; dp[a - 1][b][c] += dp[a][b][c] * paa; dp[a][b - 1][c] += dp[a][b][c] * pbb; dp[a][b][c - 1] += dp[a][b][c] * pcc; dp[a][b][c] = dp[a][b][c] * p0; } cout << fixed << setprecision(16) << ret[0] << ' ' << ret[1] << ' ' << ret[2] << '\n'; }