forked from Guarav/SPOJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCIRCLE_E.java
48 lines (33 loc) · 948 Bytes
/
CIRCLE_E.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.text.DecimalFormat;
import java.util.Scanner;
/**
* Created by gaurav on 5/28/14.
*/
public class Main {
public static void main(String [] args)
{
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while(t-->0)
{
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
double ans = getRadius(a, b, c);
DecimalFormat format = new DecimalFormat("0.000000");
ans = Double.parseDouble(format.format(ans));
System.out.println(String.format("%.6f", ans));
}
}
Main()
{
}
public static double getRadius(int a, int b, int c)
{
double r1 = (double)1/a;
double r2 = (double)1/b;
double r3 = (double)1/c;
double ans = r1 + r2 + r3 + 2*Math.sqrt(r1*r2 + r2*r3 + r3*r1);
return 1/ans;
}
}