L1-063 吃鱼还是吃肉 (10 分)
国家给出了 8 岁男宝宝的标准身高为 130 厘米、标准体重为 27 公斤;8 岁女宝宝的标准身高为 129 厘米、标准体重为 25 公斤。
现在你要根据小宝宝的身高体重,给出补充营养的建议。
输入格式:
输入在第一行给出一个不超过 10 的正整数 N,随后 N 行,每行给出一位宝宝的身体数据:
性别 身高 体重
其中性别是 1 表示男生,0 表示女生。身高和体重都是不超过 200 的正整数。
输出格式:
对于每一位宝宝,在一行中给出你的建议:
如果太矮了,输出:duo chi yu!(多吃鱼);
如果太瘦了,输出:duo chi rou!(多吃肉);
如果正标准,输出:wan mei!(完美);
如果太高了,输出:ni li hai!(你厉害);
如果太胖了,输出:shao chi rou!(少吃肉)。
先评价身高,再评价体重。两句话之间要有 1 个空格。
输入样例:
4
0 130 23
1 129 27
1 130 30
0 128 27
输出样例:
ni li hai! duo chi rou!
duo chi yu! wan mei!
wan mei! shao chi rou!
duo chi yu! shao chi rou!
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// int sex=sc.nextInt();
int count;
count = sc.nextInt();
int []sex=new int[count];
int []height=new int[count];
int []weight=new int[count];
for (int i = 0; i < count; i++) {
sex[i] = sc.nextInt();
height[i] = sc.nextInt();
weight[i] = sc.nextInt();
}
for(int i=0;i<count;i++) {
if (sex[i] == 1) {
if (height[i] < 130) {
System.out.print("duo chi yu!");
System.out.print(" ");
}
if (height[i] > 130) {
System.out.print("ni li hai!");
System.out.print(" ");
}
if (height[i] == 130) {
System.out.print("wan mei!");
System.out.print(" ");
}
if (weight[i] < 27) {
System.out.print("duo chi rou!");
System.out.println("");
}
if (weight[i] > 27) {
System.out.print("shao chi rou!");
System.out.println("");
}
if (weight[i] == 27) {
System.out.print("wan mei!");
System.out.println("");
}
}
if (sex[i] == 0) {
if (height[i] < 129) {
System.out.print("duo chi yu!");
System.out.print(" ");
}
if (height[i] > 129) {
System.out.print("ni li hai!");
System.out.print(" ");
}
if (height[i] == 129) {
System.out.print("wan mei!");
System.out.print(" "
+ "");
}
if (weight[i] < 25) {
System.out.print("duo chi rou!");
System.out.println("");
}
if (weight[i] > 25) {
System.out.print("shao chi rou!");
System.out.println("");
}
if (weight[i] == 25) {
System.out.print("wan mei!");
System.out.println("");
}
}
}
}
}