import java.util.Scanner; import java.util.Stack; import java.util.Vector; public class Main { public static void main(String args[]){ Scanner reader=new Scanner(System.in); long s; //正整数s s=reader.nextLong(); System.out.println(String.format("%.3f", 2*Math.sqrt(s/Math.PI))); } }
总结:
- 均值不等式 a+b>=2*根号ab;
- Java中控制小数精度String.format("%.3f", 2*Math.sqrt(s/Math.PI));