题目解析
判断给定的 身高体重 是什么身材的类型
解题思路
将给定的身高体重带入式子 $F = (h - 100) * 0.9 * 0.2 $
- 如果 的话 那就是 完美身材
- 否则
-
- 的话 那就是 太瘦了
-
- 的话 那就是 太胖了
代码
import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
int n = sc.nextInt();
while (n-- > 0)
{
int H = sc.nextInt();
int W = sc.nextInt();
double F = (H - 100) * 0.9 * 2;
if (Math.abs(W - F) < F * 0.1)
out.println("You are wan mei!");
else if (W - F < 0)
out.println("You are tai shou le!");
else if (W - F > 0)
out.println("You are tai pang le!");
}
out.flush();
out.close();
}
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
}