// No.58 イカサマなサイコロ #include #include #include using namespace std; int main() { int N, K; cin >> N >> K; int tot = 0, win = 0; for (int iter = 0; iter < 1000000; ++iter) { int a = 0, b = 0; for (int i = 0; i < N; ++i) a += rand() % 6 + 1; for (int i = 0; i < K; ++i) b += rand() % 3 + 4; for (int i = 0; i < N - K; ++i) b += rand() % 6 + 1; if (b > a) ++win; ++tot; } cout << fixed << setprecision(10) << (double)win / tot << endl; }