0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 00:18:48 +00:00

P4160 [SCOI2009]生日快乐

R60087012
This commit is contained in:
Baoshuo Ren 2021-10-17 11:04:58 +08:00 committed by Baoshuo Ren
parent 248b1ac56b
commit b754cea99f
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,20 @@
#include <bits/stdc++.h>
using namespace std;
int x, y, n;
double dfs(double x, double y, int k) {
if (k == 1) return max(x, y) / min(x, y);
double ans = 0x3f3f3f3f;
for (int i = 1; i <= k / 2; i++) {
ans = min({ans, max(dfs(x / k * i, y, i), dfs(x - x / k * i, y, k - i)), max(dfs(x, y / k * i, i), dfs(x, y - y / k * i, k - i))});
}
return ans;
}
int main() {
cin >> x >> y >> n;
cout << fixed << setprecision(6) << dfs(x, y, n) << endl;
return 0;
}