酷代码 AI
菜单
全部AI  /  热门  /  AI写代码神器
服务商

国家给出了 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 个空格。 用c语言

```c #include <stdio.h> int main() { int n; scanf("%d", &n); while (n--) { int gender, height, weight; scanf("%d %d %d", &gender, &height, &weight); if (gender == 1) { if (height < 130) printf("duo chi yu!"); else if (height == 130) printf("wan mei!"); else printf("ni li hai!"); printf(" "); if (weight < 27) printf("duo chi rou!"); else if (weight == 27) printf("wan mei!"); else printf("shao chi rou!"); } else { if (height < 129) printf("duo chi yu!"); else if (height == 129) printf("wan mei!"); else printf("ni li hai!"); printf(" "); if (weight < 25) printf("duo chi rou!"); else if (weight == 25) printf("wan mei!"); else printf("shao chi rou!"); } printf("\n"); } return 0; } ``` [2024-10-31 11:19:21 | AI写代码神器 | 760点数解答]

相关提问