mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-25 17:32:01 +00:00
50 lines
969 B (Stored with Git LFS)
C++
50 lines
969 B (Stored with Git LFS)
C++
#include <stdlib.h>
|
|
#include <algorithm>
|
|
#include <iostream>
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
|
|
using namespace std;
|
|
|
|
typedef long double ld;
|
|
|
|
int n, m;
|
|
ld p;
|
|
|
|
ld a[1010][1010];
|
|
|
|
bool check(ld k) {
|
|
memset(a, 0, sizeof a);
|
|
for (int i = 0; i < n; i++) {
|
|
a[i][m] = k;
|
|
}
|
|
for (int i = n - 1; i >= 0; i--) {
|
|
for (int j = m - 1; j >= 0; j--) {
|
|
a[i][j] = p * a[i + 1][j] + (1 - p) * a[i][j + 1] + 1;
|
|
if (i | j) {
|
|
if (a[i][j] > k) {
|
|
a[i][j] = k;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return a[0][0] < k;
|
|
}
|
|
|
|
int main() {
|
|
cin >> m >> n >> p;
|
|
p /= 100;
|
|
ld l = 0, r = 1000000010;
|
|
for (int i = 0; i < 100; i++) {
|
|
ld mid = (l + r) / 2;
|
|
if (check(mid)) {
|
|
r = mid;
|
|
} else {
|
|
l = mid;
|
|
}
|
|
}
|
|
cout.setf(ios::showpoint | ios::fixed);
|
|
cout.precision(20);
|
|
cout << min((l + r) / 2, 1e9l) << endl;
|
|
}
|