top1编程
← 返回题目
题解

【入门】运动会成绩统计

1 条题解

  • 0
    @ 2026-7-29 0:16:43
    #include <iostream>
    using namespace std;
    
    int main() {
        // 定义浮点型变量存储选手分数
        double score;
        // 读取输入的分数
        cin >> score;
        
        // 按分数区间判断奖项
        if (score >= 92.8) {
            cout << "jin" << endl;
        } else if (score >= 85.6) { // 能走到这里说明score < 92.8
            cout << "yin" << endl;
        } else if (score >= 82.1) { // 能走到这里说明score < 85.6
            cout << "tong" << endl;
        } else { // 分数 < 82.1
            cout << "sorry" << endl;
        }
        
        return 0;
    }
    
    • 1