Calculate the geometric mean of inputs a and b. The geometric mean of two numbers is the square root of a * b.
计算输入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));
}
}
本文来自博客园,作者:ukyo--君君小时候,转载请注明原文链接:https://www.cnblogs.com/ukzq/p/17887000.html