第一题
package step1;
import java.util.Scanner;
public class Angle {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
Double x1 = input.nextDouble();
Double y1 = input.nextDouble();
Double x2 = input.nextDouble();
Double y2 = input.nextDouble();
Double x3 = input.nextDouble();
Double y3 = input.nextDouble();
input.close();
Double A = 0.0;
Double B = 0.0;
Double C = 0.0;
//请在指定位置填写代码。
/********* Begin *********/
double a=0.0,b=0.0,c=0.0;
a=Math.sqrt((Math.pow(x2-x3,2)+Math.pow(y2-y3,2)));
b=Math.sqrt((Math.pow(x1-x3,2)+Math.pow(y1-y3,2)));
c=Math.sqrt((Math.pow(x1-x2,2)+Math.pow(y1-y2,2)));
A=Math.toDegrees(Math.acos((a*a-b*b-c*c)/(-2*b*c)));
B=Math.toDegrees(Math.acos((b*b-a*a-c*c)/(-2*a*c)));
C=Math.toDegrees(Math.acos((c*c-b*b-a*a)/(-2*b*a)));
/********* End *********/
System.out.print(String.format("%.2f %.2f %.2f", A, B, C));
}
}
第二题
package step2;
import java.util.Scanner;
public class Pentagon {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
Double l = input.nextDouble();
input.close();
Double S = 0.0;
//请在指定位置填写代码。
/********* Begin *********/
S=5*Math.pow(l,2)/(4*Math.tan(Math.PI/5));
/********* End *********/
System.out.print(String.format("%.2f", S));
}
}
第三题
package step3;
import java.util.Scanner;
public class Ploygon {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
Double l = input.nextDouble();
int n = input.nextInt();
input.close();
Double S = 0.0;
//请在指定位置填写代码。
/********* Begin *********/
S=n*Math.pow(l,2)/(4*Math.tan(Math.PI/n));
/********* End *********/
System.out.print(String.format("%.2f", S));
}
}
第四题
C