import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int cases=Integer.parseInt(br.readLine());
for(int i=0;i<cases;i++){
StringTokenizer st = new StringTokenizer(br.readLine());
double r1 = Double.parseDouble(st.nextToken());
double r2 = Double.parseDouble(st.nextToken());
double r3 = Double.parseDouble(st.nextToken());
double m1= r2+r3;
double m2= r1+r3;
double m3= r1+r2;
double theta1=Math.acos((m2*m2+m3*m3-m1*m1)/(2*m2*m3));
double theta2=Math.acos((m1*m1+m3*m3-m2*m2)/(2*m1*m3));
double theta3=Math.acos((m2*m2+m1*m1-m3*m3)/(2*m2*m1));
double med=(m1+m2+m3)/2.0;
double areaOfTri=Math.sqrt(med*(med-m1)*(med-m2)*(med-m3));
double areaofArc1=0.5*theta1*r1*r1;
double areaofArc2=0.5*theta2*r2*r2;
double areaofArc3=0.5*theta3*r3*r3;
double ans=areaOfTri-areaofArc1-areaofArc2-areaofArc3;
System.out.printf("%.6f\n", ans);
}
}
}
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int cases=Integer.parseInt(br.readLine());
for(int i=0;i<cases;i++){
StringTokenizer st = new StringTokenizer(br.readLine());
double r1 = Double.parseDouble(st.nextToken());
double r2 = Double.parseDouble(st.nextToken());
double r3 = Double.parseDouble(st.nextToken());
double m1= r2+r3;
double m2= r1+r3;
double m3= r1+r2;
double theta1=Math.acos((m2*m2+m3*m3-m1*m1)/(2*m2*m3));
double theta2=Math.acos((m1*m1+m3*m3-m2*m2)/(2*m1*m3));
double theta3=Math.acos((m2*m2+m1*m1-m3*m3)/(2*m2*m1));
double med=(m1+m2+m3)/2.0;
double areaOfTri=Math.sqrt(med*(med-m1)*(med-m2)*(med-m3));
double areaofArc1=0.5*theta1*r1*r1;
double areaofArc2=0.5*theta2*r2*r2;
double areaofArc3=0.5*theta3*r3*r3;
double ans=areaOfTri-areaofArc1-areaofArc2-areaofArc3;
System.out.printf("%.6f\n", ans);
}
}
}
No comments:
Post a Comment