File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+ import java.io.* ;
3+ import java.util.* ;
4+
5+ public class Main {
6+ static double x, y, c;
7+
8+ public static void main (String [] args ) throws IOException {
9+ BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
10+ StringTokenizer st = new StringTokenizer (br. readLine());
11+ x = Double . parseDouble(st. nextToken());
12+ y = Double . parseDouble(st. nextToken());
13+ c = Double . parseDouble(st. nextToken());
14+
15+ double left = 0.0 ;
16+ double right = Math . min(x, y);
17+ double ans = 0.0 ;
18+
19+ for (int i = 0 ; i < 10000 ; i++ ) {
20+ double mid = (left + right) / 2.0 ;
21+ double h1 = Math . sqrt(x * x - mid * mid);
22+ double h2 = Math . sqrt(y * y - mid * mid);
23+ double tempc = (h1 * h2) / (h1 + h2);
24+ if (tempc >= c) {
25+ ans = mid;
26+ left = mid;
27+ } else {
28+ right = mid;
29+ }
30+ }
31+
32+ System . out. printf(" %.3f\n " , ans);
33+ }
34+ }
35+ ```
You can’t perform that action at this time.
0 commit comments