2020-PTA总决赛-L1-5 胎压监测(仅代码)

Code:

#include<iostream>
using namespace std;
int T[4];
int main(){
    int lowWarn, largeWarn, max = 0;
    for(int i = 0; i < 4; i++){
        cin >> T[i];
        if(T[i] > max) max = T[i];
    }
    cin >> lowWarn >> largeWarn;
    int cnt = 0, id;
    for(int i = 0; i < 4; i++){
        if(T[i] < lowWarn || (max - T[i]) > largeWarn){
            id = i + 1;
            cnt++;
        }
    }
    if(!cnt){
        cout << "Normal";
    }else if(cnt == 1){
        cout << "Warning: please check #" << id << "!";
    }else{
        cout << "Warning: please check all the tires!";
    }
    return 0;
}
posted @ 2025-03-03 16:37  Yuhhhhh  阅读(17)  评论(0)    收藏  举报