top1编程
← 返回题目
题解

【入门】宇航员选拔

1 条题解

  • 0
    @ 2026-7-29 0:16:52
    #include <iostream>
    using namespace std;
    
    int main() {
        int age, weight, height;
        cin >> age >> weight >> height;
    
        // 判断是否符合三个标准(均包含边界值)
        if (age >= 16 && age <= 19 &&
            weight >= 50 && weight <= 80 &&
            height >= 165 && height <= 185) {
            cout << "Y" << endl;
        } else {
            cout << "N" << endl;
        }
    
        return 0;
    }
    
    • 1