L1-061 新胖子公式 - java

题目解析

给定 体重 和 身高
输出 计算结果 和 指定字符串

解题思路

直接计算即可

然后判断输出

代码

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

public class Main
{

	public static void main(String[] args)
	{
		double w = sc.nextDouble();
		double h = sc.nextDouble();

		double ans = w / (h * h);

		out.printf("%.1f\n", ans);
		if (ans > 25)
			out.println("PANG");
		else
			out.println("Hai Xing");

		out.flush();
		out.close();
	}

	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
}



团体程序设计天梯赛-练习集-java

赞赏