#include #include #include using namespace std; int main(){ cout << fixed << setprecision(5); int N; cin >> N; int K; cin >> K; vector> dp(N + 1, vector(N * 6 + 1, 0)); dp[0][0] = 1; for (int i = 0; i < N; i++){ for (int j = 0; j <= i * 6; j++){ for (int k = 0; k < 6; k++){ dp[i + 1][j + k] += dp[i][j] / 6; } } } vector> dp2(N + 1, vector(N * 6 + 1, 0)); dp2[0][0] = 1; for (int i = 0; i < K; i++){ for (int j = 0; j <= i * 6; j++){ for (int k = 4; k < 6; k++){ dp2[i + 1][j + k] += dp2[i][j] / 3; } } } for (int i = K; i < N; i++){ for (int j = 0; j <= i * 6; j++){ for (int k = 0; k < 6; k++){ dp2[i + 1][j + k] += dp2[i][j] / 6; } } } double ans = 0; for (int i = 0; i <= N * 6; i++){ for (int j = i + 1; j <= N * 6; j++){ ans += dp[N][i] * dp2[N][j]; } } cout << ans << endl; }