Calculate the geometric mean of inputs a and b. The geometric mean of two numbers is the square root of a * b.

发布时间 2023-12-08 13:50:35作者: ukyo--BlackJesus

计算输入a和b的几何平均值。两个数字的几何平均值是a * b的平方根。

import java.util.*;
import java.io.*;
import java.math.*;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
class Solution {

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();

        // Write an answer using System.out.println()
        // To debug: System.err.println("Debug messages...");

        System.out.println((int)Math.sqrt(a*b));
    }
}