Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions JinHyeok/202507/23 BAJ 사다리.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
```
#include <iostream>
#include <cmath>
using namespace std;

double x, y, c;

double getHeight(double len, double width) {
return sqrt(len * len - width * width);
}

bool isPossible(double width) {
double h1 = getHeight(x, width);
double h2 = getHeight(y, width);
double meet = (h1 * h2) / (h1 + h2);
return meet >= c;
}

int main() {
cin >> x >> y >> c;

double low = 0;
double high = min(x, y);
double mid;

for (int i = 0; i < 100; ++i) {
mid = (low + high) / 2;
if (isPossible(mid)) {
low = mid;
} else {
high = mid;
}
}

cout.precision(10);
cout << fixed << mid << endl;

return 0;
}


```