2020年团体程序设计天梯赛 L1-5 胎压监测

思路:

水题,略过

Tip:

#include <bits/stdc++.h>

using namespace std;

int a[5];
int di, yu, maxx;
int indexx;

int main() {
    bool flag1 = false;
    bool flag2 = false;
    for (int i = 1; i <= 4; i++) {
        cin >> a[i];
        maxx = max(maxx, a[i]);
    }
    cin >> di >> yu;
    for (int i = 1; i <= 4; i++) {
        if (a[i] < di || maxx - a[i] > yu) {
            if (flag2) {
                flag1 = true;
                break;
            } else {
                flag2 = true;
                indexx = i;
            }
        }
    }
    if (flag1) {
        cout << "Warning: please check all the tires!" << endl;
    } else if (flag2) {
        cout << "Warning: please check #" << indexx << "!" << endl;
    } else {
        cout << "Normal" << endl;
    }
    return 0;
}

  

原文地址:https://www.cnblogs.com/Whiteying/p/14056473.html