PTA 团体程序设计天梯赛-练习集 L1-063 吃鱼还是吃肉 (10 分)

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!

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<sstream>
#define ll long long
#define mes(x,y) memset(x,y,sizeof(x))
using namespace std;
int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int a,b,c;   //性别、身高、体重
        cin >> a >> b >> c;
        if(a == 1){  //男生
            if(b > 130){
                cout << "ni li hai! ";
            }
            else if(b == 130){
                cout << "wan mei! ";
            }
            else{
                cout << "duo chi yu! ";
            }
            if(c > 27){
                cout << "shao chi rou!" << endl;
            }
            else if(c == 27){
                cout << "wan mei!" << endl;
            }
            else{
                cout << "duo chi rou!" << endl;
            }
        }
        else{  //女生
            if(b > 129){
                cout << "ni li hai! ";
            }
            else if(b == 129){
                cout << "wan mei! ";
            }
            else{
                cout << "duo chi yu! ";
            }
            if(c > 25){
                cout << "shao chi rou!" << endl;
            }
            else if(c == 25){
                cout << "wan mei!" << endl;
            }
            else{
                cout << "duo chi rou!" << endl;
            }
        }
    }
}
发布了148 篇原创文章 · 获赞 7 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_44417851/article/details/90474101