2019年天梯赛-全国总决赛-L1-061 新胖子公式 (10 分)

题目链接:https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858882

题目大意:给出身高和体重,按体重(kg) / 身高(m) 的平方计算。如果超过 25 输出 PANG,否则输出 Hai Xing。

#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

int main(){
    double x,y;
    cin >> x >> y;
    double s=x/y/y;
    cout << fixed << setprecision(1) << s << "\n";
    if(s>25){
        cout << "PANG\n";
    }else{
        cout << "Hai Xing\n";
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_26122455/article/details/88929035