常用数学函数

第一题

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值