/* -*- coding: utf-8 -*- * * 1688.cc: No.1688 Veterinarian - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 50; const int MAX_A = 50; const int MAX_B = 50; const int MAX_C = 50; /* typedef */ /* global variables */ double dp[MAX_N + 1][MAX_A + 1][MAX_B + 1][MAX_C + 1]; /* subroutines */ inline int nc2(int n) { return n * (n - 1) / 2; } /* main */ int main() { int a, b, c, n; scanf("%d%d%d%d", &a, &b, &c, &n); dp[0][a][b][c] = 1.0; for (int i = 0; i < n; i++) for (int x = a; x > 0; x--) { int a2 = nc2(x); for (int y = b; y > 0; y--) { int b2 = nc2(y); for (int z = c; z > 0; z--) if (dp[i][x][y][z] > 0.0) { int s2 = nc2(x + y + z), c2 = nc2(z); dp[i + 1][x - 1][y][z] += dp[i][x][y][z] * a2 / s2; dp[i + 1][x][y - 1][z] += dp[i][x][y][z] * b2 / s2; dp[i + 1][x][y][z - 1] += dp[i][x][y][z] * c2 / s2; dp[i + 1][x][y][z] += dp[i][x][y][z] * (s2 - (a2 + b2 + c2)) / s2; } } } double ea = 0.0, eb = 0.0, ec = 0.0; for (int x = a; x > 0; x--) for (int y = b; y > 0; y--) for (int z = c; z > 0; z--) if (dp[n][x][y][z] > 0.0) { ea += dp[n][x][y][z] * (a - x); eb += dp[n][x][y][z] * (b - y); ec += dp[n][x][y][z] * (c - z); } printf("%.16lf %.16lf %.16lf\n", ea, eb, ec); return 0; }