Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 19;
- double p[N][N];
- int main () {
- int n, m, k; cin >> n >> m >> k;
- double t = n * m;
- p[0][0] = 1;
- for (int j = 1; j <= k; j++) {
- for (int i = 0; i <= min (j, (int) t); i++) {
- p[i][j] = (i > 0 ? p[i - 1][j - 1] * ((t - (i - 1)) / t) : 0) + p[i][j - 1] * (i / t);
- }
- }
- double ans = 0;
- for (int i = 1; i <= k; i++) {
- ans += p[i][k] * i;
- }
- cout << fixed << setprecision (12) << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement