C语言-吃鱼还是吃肉-PTA

国家给出了 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!

#include <stdio.h>

int main()
{
    int row, sex, height, weight, i;
    scanf("%d", &row);
    for (i = 1; i <= row; i++)
    {
        
            scanf("%d %d %d", &sex, &height, &weight);
            switch (sex)
            {
                case(1):
                {
                    if (height < 130)
                        printf("duo chi yu! ");
                    else if (height == 130)
                        printf("wan mei! ");
                    else
                        printf("ni li hai! ");
                    if (weight < 27)
                        printf("duo chi rou!");
                    else if (weight == 27)
                        printf("wan mei!");
                    else
                        printf("shao chi rou!");
                    break;
                }
                case(0):
                {
                    if (height < 129)
                        printf("duo chi yu! ");
                    else if (height == 129)
                        printf("wan mei! ");
                    else
                        printf("ni li hai! ");
                    if (weight < 25)
                        printf("duo chi rou!");
                    else if (weight == 25)
                        printf("wan mei!");
                    else
                        printf("shao chi rou!");
                    break;
                }

            }
        
        printf("\n");
    }

    return 0;
}

 

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值